-
AuthorPosts
-
January 22nd, 2019 at 20:27 #72966
Here’s the issue we’re having on my client’s site..
She wanted search results to open in a new page/tab, so we set it up that way.
We are using the AJAX Search Pro search plugin instead of the default.
I already reached out to the plugin developer, and he says the issue is theme related and not the AJAX Search Pro plugin.The problem..
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.
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 child theme when I found it was not working.Have you any suggestions?
Thank you.
Website: cinnsroadtrip.blog
February 4th, 2019 at 17:01 #73355ZedCryout Creations mastermindPage (and section titles in general) are handled by WordPress. If you’re looking to customize theme, you should try a SEO plugin (Yoast has such a feature).
If you like our creations, help us share by rating them on WordPress.org.
Please check the available documentation and search the forums before starting a topic. -
AuthorPosts
The topic ‘Search result page title at top of the browser’ is closed to new replies.