Forums Forums Search & Filter Pro Wp Title not working

Viewing 10 posts - 1 through 10 (of 14 total)
  • Anonymous
    #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
    #61560

    Try this instead:

    add_filter('pre_get_document_title', 'search_form_title');
    function search_form_title($title){
     global $searchandfilter;
     if ( $searchandfilter->active_sfid() == 35889) {
       return 'Search Results';
     } else {
       return $title;
     }
    }
    Anonymous
    #62697

    Hello Trevor, the is broking my site, not sure why.

    Anonymous
    #62699

    The code*

    Trevor
    #62755

    Where did you put it?

    Anonymous
    #62808

    I place it on functions.php, is not the place?.

    Trevor
    #62819

    Is 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
    #62951

    Hope 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,
    Colin

    Trevor
    #62971

    Maybe 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
    #63437

    Thanks 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

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