Forums › Forums › Search & Filter Pro › Wp Title not working
- This topic has 13 replies, 3 voices, and was last updated 8 years, 7 months ago by
Anonymous.
-
Anonymous(Private) September 30, 2016 at 10:22 pm #61330
With the last update of wordpress, this code on the documentation is not working anymore:
add_filter(‘wp_title’,’search_form_title’); function search_form_title($title){ global $searchandfilter; if ( $searchandfilter->active_sfid() == 35889) { return ‘Search Results’; } else { return $title; } }
Do you have another turn around for this?
Does de the Custom Post Type Archive has the same problem with title?.Trevor(Private) October 8, 2016 at 12:33 pm #62819Is this the functions.php file for your theme or child theme? In most cases, you should be using a child theme and the functions.php file for this is normally quite short, in which case, can you paste it here inside code tags (from the editor toolbar) the failing functions.php, because I cannot see anything wrong with the snippet I gave you?
Anonymous(Private) October 10, 2016 at 5:51 am #62951Hope it is ok to add to this post.
I am having the same issue, my page title for the results page is “Blog” and I cannot seem to alter it.
I have used our code Trevor and it was accepted. (My site did not crash).
However it did not seem to make any changes to the results page or any settings.The location of my functions.php page is inside my “appearance” tab under “Editor”
I have set the display results method as “As an archive”
I have included the page URL for your reference.
http://australianfurniture.org.au/members/find-a-member/The search works great, just need to change the page title.
Would appreciate some help or direction.Kind regards,
ColinTrevor(Private) October 10, 2016 at 8:24 am #62971Maybe it needs to be run late, like this:
add_filter('pre_get_document_title', 'search_form_title', 10, 1); function search_form_title($title){ global $searchandfilter; if ( $searchandfilter->active_sfid() == 35889) { return 'Search Results'; } else { return $title; } }
Anonymous(Private) October 12, 2016 at 3:58 am #63437Thanks for the swift response Trevor,
I have tried your altered code in the functions.php file
It does not seem to affect the results page.
I am not a programmer so my skills in this area are limited but can you suggest an alert or something to test if this code is actually being picked up by the results page?Kind regards,
Colin -
AuthorPosts