Forums Forums Search & Filter Pro Show only results for author of shortcoded page

Viewing 4 posts - 1 through 4 (of 4 total)
  • Ross Moderator
    #8925

    Hey there

    Sorry for the generic message – I got locked out and blacklisted by my host for this website!! – so been unable to login and reply to tickets – playing catchup now – will be systematically working through tickets today.

    Thanks

    Anonymous
    #8949

    Thanks Ross! Appreciate your help! I just need a way of the only showing the results, categories and tags for the author of the page that the shortcode is placed in.

    Ross Moderator
    #9038

    Hey Chris

    Just got around to looking at this.

    The plugin does not allow for this functionality – I’m having a look to see if you can hook in to the query to modify it yourself and add such parameters but really its out of scope of the plugin.

    Thanks

    Ross Moderator
    #9952

    Hey Chris

    Although I don’t support it, you should be able to hook in to the query generated by the plugin and modify it using pre_get_posts

    This is some sample code which may help (add this to functions.php of your theme) –

    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())
        {
    		//we can add our modifications here:
    		$authorID = 1;
    		$query->set('author', implode(",", $authorID)); 
    
    		//not necessary but we can match the search form ID in case we are using multiple search forms
    		/*if($sf_form_data->form_id()==797)
    		{
    			
    		}*/
    		
        }
    }
    add_action( 'pre_get_posts', 'modify_search_filter_query', 21 );

    Thanks

Viewing 4 posts - 1 through 4 (of 4 total)