Viewing 15 replies - 1 through 15 (of 19 total)
  • Plugin Author TC.K

    (@wp_dummy)

    Have you check on the ‘OR’ boolean relationship in the form setting page?

    Thread Starter Aldo

    (@ab_lu)

    No, AND is selected.

    Plugin Author TC.K

    (@wp_dummy)

    I think you have misunderstood the plugin boolean relationship. It is use to compare each of the of the taxonomy, not taxonomy’s term.
    Eg.
    type AND type2 AND type3….

    not
    type
    -term AND term2
    type2
    -term3 AND term4

    Thread Starter Aldo

    (@ab_lu)

    Ok. so lets say I have a taxonomy “Mailing-Options” with three terms:
    – Customers
    – Friends
    – Family

    Now I would like to check Friends and Familiy, to get all the entries who have BOTH terms associated.

    Is this possible?

    Plugin Author TC.K

    (@wp_dummy)

    No, it will search the post with “Friend” and with “Family”

    Thread Starter Aldo

    (@ab_lu)

    Is there a way to add an option who generates the query in the background so all terms match?
    https://codex.www.ads-software.com/Class_Reference/WP_Query#Taxonomy_Parameters

    Plugin Author TC.K

    (@wp_dummy)

    Yes, you can. I have the filter for this – ajwpqsf_get_taxo()
    Example:

    add_filter('ajwpqsf_get_taxo', 'new_query', '' ,3);
    function new_query($taxo,$id, $gettaxo){
       $taxo[] = array(
    		'taxonomy' => 'product_cat',
    		'field' => 'slug',
    		'terms' => 'new-arrival',
    		'operator' => 'IN'
      	);
    	return $taxo;
    }
    Thread Starter Aldo

    (@ab_lu)

    Ok, lets say I have a taxonomy with “mailing-options”, with the terms “christmas” and “easter”.
    How would the function look like to check for both terms?

    Previously we created the form containing the checkboxes for the taxonomy with your plugin.

    Thanks!
    Aldo

    Plugin Author TC.K

    (@wp_dummy)

    I don’t think so. If you created in the plugin, then it will automatically handle by the plugin.

    Thread Starter Aldo

    (@ab_lu)

    Would it be an option to extend your plugin so that you could set the boolean relationship between the taxonomy terms queries to AND, OR and so on?
    This would be a great addon!

    Thread Starter Aldo

    (@ab_lu)

    I managed to make the changes in your plugin.
    Maybe you can give me a feedback if there are any potential issues:

    In process.php a changed the following:
    After line 136 added
    , 'operator' => 'AND'

    After line 144 added
    , 'operator' => 'AND'

    In line 183 removed:
    && empty($keyword)

    As I mentioned before, it would be great if in the WP backend of your plugin we could set the operator between the taxonomy terms.

    Regarding the change on line 183 I’m not sure if it breaks anything.

    Plugin Author TC.K

    (@wp_dummy)

    If you do this, all your taxonomies terms will behave with the AND boolean relationship. It is fine if you have only one search form, but if you have other search form to create, then this could be an issue. Also, you will have to change this every time you update the plugin.

    Actually you can set the changes without making any changes on the plugin file by using the filter ajwpqsf_get_taxo().

    Example is at here.

    Thread Starter Aldo

    (@ab_lu)

    Thanks for your feedback.
    I get to warnings using your hook:
    Warning: Missing argument 2 for my_custom_process() in /home/interpub/www/dev.site.com/wp-content/themes/interface/functions.php on line 191
    Warning: Missing argument 3 for my_custom_process() in /home/interpub/www/dev.site.com/wp-content/themes/interface/functions.php on line 191

    The affected line is:
    function my_custom_process($taxo,$id, $gettaxo ){

    Plugin Author TC.K

    (@wp_dummy)

    Oh yes, need to defined the number of arguments for the hook.
    Try this
    add_filter('ajwpqsf_get_taxo','my_custom_process','' 3);

    Thread Starter Aldo

    (@ab_lu)

    Works perfect ?? Thanks!

    Last thing, line 183 in process.php:
    && empty($keyword)

    I removed this to have it strict, so the search string and the terms are checked.
    Any way to manipulate this through a hook?

Viewing 15 replies - 1 through 15 (of 19 total)
  • The topic ‘Results with multiple taxonomies not accurate’ is closed to new replies.