Support Forums

Looking for support? You can access the support system via your account.

Forums Forums Search & Filter Pro Excluded categories on specific forms

Viewing 10 posts - 11 through 20 (of 21 total)
  • Joe
    #2928

    So is this feaseable to do or no? You said you were taking a look at this for for the last few evenings and there hasnt been any word. If you cant accomodate it let me know so i can move on with another plugin that does what im looking for.

    Thanks.

    Ross Moderator
    #2929

    Hi Joe

    As mentioned, this requires me to update the plugin which unfortunately is no simple task – there are many considerations before pushing a plugin update including testing – so sorry I did not get this working quickly for you, but this is above and beyond regular plugin support.

    I would say that even pushing an a plugin update within one week to accommodate a specific users requirements is nothing short of extremely fast, so please be patient.

    I am dedicating the whole of Sunday now to testing and updating the plugin and then I will be able to help with supplying your additional code to achieve what you specifically require in your setup.

    Thanks

    Joe
    #2930

    I sent you a message through your contact form. Sorry that this is “above and beyond” plugin support. You were more than willing to help someone achieve this in another support ticket.

    This statement will affect all search & Filter forms however, so if you are using more than one form on your site you will need some more conditional statements.. let me know if this is the case?

    Ross Moderator
    #2931

    Hey Joe, it is above and beyond regular support – regular support the way I see it is to make sure a user can get the plugin setup and working as advertised – anything extra is not typically in the realm of support and should be additional work/cost – but… I’m more than happy to do it! Just give me a little time, of course updates etc are for the users which I try to do but these things simply take time..! :/

    Ross Moderator
    #2961

    Hey all…

    You can now target the queries from individual forms and modify them using pre_get_posts using the following code:

    function modify_search_filter_query( $query )
    {
        global $sf_form_data;
    	global $wp_query;
    	
        if ( $sf_form_data->is_valid_form() && $query->is_main_query() && !is_admin())
        {
    		
    		if($sf_form_data->form_id()==12) //where the form ID is 12
    		{
    			//modify the query for a form with id 12
    			$query->set( 'cat', '-2' );
    		}
    		else if($sf_form_data->form_id()==99) //where the form ID is 99
    		{
    			//modify the query for a form with id 99
    			$query->set( 'cat', '-20' );
    		}
    		
        }
    }
    add_action( 'pre_get_posts', 'modify_search_filter_query', 21 );

    You can get the ID of the form by looking at the URL in the edit screen (when editing your S&F form)

    http://www.yoursite.com/wp-admin/post.php?post=797&action=edit

    In this case it would be 797.

    I’m updating the plugin right now so expect to see it in your dashboards shortly.

    Let me know if you have any questions!

    Joe
    #3002
    This reply has been marked as private.
    Joe
    #3003
    This reply has been marked as private.
    Joe
    #3008
    This reply has been marked as private.
    Joe
    #3010

    Not sure if this is the most efficient way of doing this but I managed to exclude specific taxonomy terms from specific forms by altering the code above to this.

    function modify_search_filter_query( $query )
    {
        global $sf_form_data;
    	global $wp_query;
    	
        if ( $sf_form_data->is_valid_form() && $query->is_main_query() && !is_admin())
        {
    		
    		if($sf_form_data->form_id()==291)
    		{
    			        $query->set( 'tax_query',
                array(
                    array(
                        'taxonomy' => 'YOUR-TAXONOMY',
                        'field' => 'id',
                        'terms' => array( 34,33,32,31,30,29,28,27,26,25,24,23,21 ),
                        'operator' => 'NOT IN'
                    )
                )
            );
    		}
    		
        }
    }
    add_action( 'pre_get_posts', 'modify_search_filter_query', 21 );
    Joe
    #3012

    Never mind, that didnt work. Ill stop now. lol.

Viewing 10 posts - 11 through 20 (of 21 total)

You must be logged in to reply to this topic.