This website uses cookies to personalize your experience. By using this website you agree to our cookie policy.

Page Title in browser tab with search result in new page

Home Forums Product Support Forums Ajax Search Pro for WordPress Support Page Title in browser tab with search result in new page

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #20873
    Timothy HallTimothy Hall
    Participant

    Ernesto,

    VERY IMPORTANT – my email address has changed FROM [email protected] TO [email protected]. My registered email here was never changed. If you send replies to [email protected], I will never get it.
    Please change my account info to reflect the correct address… [email protected]
    THANK YOU

    Okay, I just re-upped my support agreement as you suggested.

    The issue I reported on Jan 1 (commented after this email) will have to wait for another time, as one of my clients (where AJAX Search Pro) is being used brought to my attention an issue of her own.
    I would like us to address this issue first.

    I created an Admin login for you.
    Here’s your credentials (if you should need them)..

    Goto: https://cinnsroadtrip.blog/wp-admin
    USERNAME: ajaxsearchpro
    PASSWORD: p1KXAUvG%NUQ99B@1YvMZ$4P

    The id of the search is [wd_asp id=3].

    Here’s the issue we’re having on her site..

    My client wanted search results to open in a new page/tab, so we set it up that way.
    When a search is submitted, the search itself works fine.
    However, by looking at this screenshot you’ll see the issue.

    The page title of the search results page displays “Home” – and she wants it to say “Search Results” instead.
    The Issue

    I am using a child theme, so I tried entering the following code to the child theme’s functions.php (code that I found online -I am not a PHP programmer)..

    /**
     * Modify the document title for the search page
     */
    add_filter( 'document_title_parts', function( $title )
    {
        if ( is_search() ) 
            $title['title'] = sprintf( 
                esc_html__( 'Search Results', 'my-theme-domain' ), 
                get_search_query() 
            );
    
        return $title;
    } );
    /**
     * Modify the page part of the document title for the search page
     */
    add_filter( 'document_title_parts', function( $title ) use( &$page, &$paged )
    {
        if ( is_search() && ( $paged >= 2 || $page >= 2 ) && ! is_404() ) 
            $title['page'] = sprintf( 
                esc_html__( 'Search Results', 'my-theme-domain' ), 
                max( $paged, $page ) 
            );
    
        return $title;
    } );

    But this didn’t work.
    So I removed it from the chid theme when I found it was not working.

    Have you any suggestions?

    Thank you.

    –Timothy Hall
    [email protected]
    (707) 357-6807

    • This topic was modified 7 years, 4 months ago by Timothy HallTimothy Hall.
    #20885
    Ernest MarcinkoErnest Marcinko
    Keymaster

    Hi Timothy,

    I have updated your email as requested.

    The problem is, that the plugin has no effect on the page title there whatsoever, it is a theme related issue, usually it is hard coded into the theme’s header.php file. The code you have, will only work if the document title is properly printed there, and there is no .htaccess override active from any source.

    Instead of using custom codes, I would suggest trying the YOAST Seo plugin. It’s free, fast, and is pecifically made for this. I believe it has the feature to construct .htaccess rules to override the page titles on the results page as well as archive pages etc.., and it’s also a nice addition to your site. It gives you a better page title/seo options overall.
    If the custom codes and the plugin does not work, then you might have to contact the theme author to ask what might be going wrong there. The custom codes you have there should work though, they seem to be correct.

    PS.: I tried to log-in via FTP and SFTP as well to check, but I got a password authentication error every time.

    #20907
    Timothy HallTimothy Hall
    Participant

    Thanks for getting back to me.
    I just posted a similar help request on the theme devs free support forum.

Viewing 3 posts - 1 through 3 (of 3 total)
  • The topic ‘Page Title in browser tab with search result in new page’ is closed to new replies.