Forums › Forums › Search & Filter Pro › Archive results – Update Page Title problem
- This topic has 12 replies, 3 voices, and was last updated 9 years, 8 months ago by
Anonymous.
-
Anonymous(Private) May 5, 2016 at 1:01 pm #44759
Hello ๐
I have my results page set-up to show as an archive and it uses my archive.php template.
It in turn by default shows the Page Title of the first post in the loop, so I added the code below to my functions.php file as per the documentation
add_filter('wp_title','search_form_title'); function search_form_title($title){ global $searchandfilter; if ( $searchandfilter->active_sfid() == 1242) { return 'Know-how Filter search results'; } else { return $title; } }My form is [searchandfilter id=”1242″] so 1242 should be right?
Any ideas why this isn’t working :).
Many thanks,
TJAnonymous(Private) May 5, 2016 at 4:30 pm #44787Hi Trevor,
Many thanks for getting back, sadly not sure I’m fully understanding. So that link I gave shows the results, and the form is revealed when you click the “FILTER” link which basically feeds the results into that same page, but even when it’s displaying results, the page title isn’t changing.
The page is powered by my standard archive.php template, and I within the S&F settings I set the page to have the following slug /know-how-filter/ as you can see, but it’s not a “real” page, so I thought that code was the way to override the archive title with an appropriate results title?
Many thanks,
TJTrevor(Private) May 5, 2016 at 4:49 pm #44788The page I see has a yellow search by keyword box in the middle, yes? That is a Search and Filter FORM. The code you used only works on a search results page that the form sends to. Did you try make a page in WP with that same slug and set a title to it?
Anonymous(Private) May 5, 2016 at 6:42 pm #44806Ah yep, sorry for the confusion :). Sadly yes tried what you said and created a page with that slug, but didn’t change anything sadly, I suppose because it is set to display as an archive it’s working off of the archive functionality. And that’s what I thought the Update Page Title filter was for as it made complete sense.
Ross Moderator(Private) May 12, 2016 at 9:43 pm #45433Are you using yoast by any chance? or another plugin which could affect titles?
For yoast, I think the filter is
wpseo_titleorseo_title๐Also please double check the ID of your search form, when importing / exporting IDs get changes :/
Thanks
-
AuthorPosts