Forums › Forums › Search & Filter Pro › Single author page customisation advice
- This topic has 10 replies, 2 voices, and was last updated 9 years, 4 months ago by Anonymous.
-
Anonymous(Private) July 3, 2015 at 12:38 pm #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?
Ross Moderator(Private) July 8, 2015 at 12:07 pm #21004Hey 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(Private) July 8, 2015 at 12:40 pm #21014Hey 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?
Anonymous(Private) July 8, 2015 at 1:20 pm #21020No 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(Private) July 8, 2015 at 1:25 pm #21021Hi 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(Private) July 9, 2015 at 9:37 am #21093Anyway 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(Private) July 9, 2015 at 12:01 pm #21108Hey 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:
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
-
AuthorPosts