Forums Forums Search & Filter Pro Single author page customisation advice

Viewing 10 posts - 1 through 10 (of 11 total)
  • Anonymous
    #20695

    Hi,
    got no specific issues just need an advice on customisation.

    Once I got how this plugin works the WP world changed completely for me!
    Is absolutely great, I improved WP search results, filters for single categories etc.

    I setup a filter inside the single author page.
    I want to filter posts categories etc by author.

    It works like a charm BUT on my theme when I select a filter I lose the top author info.

    any advice on how to solve it?

    Anonymous
    #20696
    This reply has been marked as private.
    Ross Moderator
    #21004

    Hey there, thanks for the kind words – I had a quick look, but I’m not sure what you mean about “losing the top author info” ?

    Anonymous
    #21014

    Hey Ross, just being honest if someone gets how it works there’s a lot to do with it!
    Especially improving WP search results page.

    I mean, if you click on that link and then select a filter on the right the top part with Author name and info disappear.

    Maybe I have to change the “landing page” for search and filter result?

    Ross Moderator
    #21019
    This reply has been marked as private.
    Anonymous
    #21020

    No I thought it was like for the other pages.
    I thought my mistake was inside the display results settings. Thought I needed a different link in there?

    Basically I want to use your plugin to filter inside each author.

    As I said works great but as you can see I lose the top info when searching? there’s an easy fix for this?

    didn’t understood what you mean

    Ross Moderator
    #21021

    Hi again, basically there is no easy fix, it requires customisation of your search template – which actually shouldn’t be too difficult if you are comfortable creating/editing WordPress page templates.

    Thanks

    Anonymous
    #21022

    yes but I wanted not to change too much the theme itself for future updates.

    Thought that it will be ok just as in the search page.

    as you can see if you search now you get that great filter on the right.

    Anonymous
    #21093

    Anyway if I decide to edit the theme, I have to do it in the author.php page?

    can you tell me a little bit more (if you have time) about the code?

    I understand that I have to “tell” the filter to make the search each time inside the relative authors posts, right?

    thanks

    Ross Moderator
    #21108

    Hey there

    Yeah I guess it would be that page – or the page you have defined as your results template under the “display results” tab.

    To modify the search to only display results from the current author you would need to modify the search query (I don’t know exactly your setup) but this is how you might go about modifying the results:

    https://support.searchandfilter.com/forums/topic/complicated-custom-meta-field-search-dates-filtering/#post-11792

    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 );

    To be honest I’m not sure how you would go about combining the above with what you are trying to do but I am working on somethign in S&F 2.0 which will automatically detect the variables on the page where S&F is placed and to use those in the query 😉

    Thanks

Viewing 10 posts - 1 through 10 (of 11 total)