Support Forums

Looking for support? You can access the support system via your account.

Forums Forums Search & Filter Pro Search page title

Viewing 8 posts - 1 through 8 (of 8 total)
  • Noeste IJver
    #145776

    Hello,

    We’ve implemented S&F on a website. We’ve configured a form as the standard search:

    http://www.agro-chemie.nl/zoeken

    Is there an option or another way to change the title on this page? Now it seems to default to the page for posts. In our case that page is titled ‘Blogs’, which is not the title we want..

    Thanks in advance!
    -Kevin

    Trevor Moderator
    #145787

    It is happening because your theme is making this the body tag:

    <body class="blog group-blog hfeed colors-light search search-results">
    

    The theme uses the blog class to decide this is a blog page. The first thing to try is in the Advanced Settings of the plugin, try the force is_archive is true setting.

    Noeste IJver
    #145799

    I’ve tried to force is_search and is_archive to always be true, but there’s no change in the page title.

    When I look at the body classes, it still has the ‘blog’ class. Is that normal behaviour?

    Trevor Moderator
    #145807

    It rather depends on the theme. Are you using the As an Archive display results method and is the template file selected search.php and if so are you using a child theme?

    Noeste IJver
    #145811

    Settings are:

    – Display results method: As an Archive
    – Custom template: search.php
    – We are using a child theme

    Trevor Moderator
    #145826

    If you look inside the search.php template file, is there any obvious call to print out the title etc?

    It may be possible to copy this file to a new name (e.g. search-result.php) and put that in the child theme folder and tell the search form to use that instead.

    Noeste IJver
    #146025

    Not really.

    We use get_header(), the real page title is printed there via wp_head().

    I guess the best way to do this, is to use something like this:

    
    /**
     * Modify the document title for the search page
     */
    add_filter( 'document_title_parts', function( $title )
    {
        if ( is_search() ) 
            $title['title'] = sprintf( 
                esc_html__( '“%s” result page', 'my-theme-domain' ), 
                get_search_query() 
            );
    
        return $title;
    } );
    

    It’s not really variable, but it works!

    Trevor Moderator
    #146059

    Indeed, if there is no other way, then that would work.

Viewing 8 posts - 1 through 8 (of 8 total)

The topic ‘Search page title’ is closed to new replies.