Digital experiences for all disciplines
New Landing › How can we help? › Themeforest Theme Support › Dante › How to change the page title srting for search result page "You searched for"?
New Landing › How can we help? › Themeforest Theme Support › Dante › How to change the page title srting for search result page "You searched for"?
- This topic has 13 replies, 3 voices, and was last updated 9 years by
Mohammad – SUPPORT.
-
Posted in: Dante
-
May 6, 2015 at 7:38 am #172213
Hi,
I’m looking for a way to change the page title of search result page, right now mine’s looks like this: You searched for x | Site Name
I’ve tried looking into search.php and Theme’s MO/PO file with no luck.
It is different from the Dante Demo site (x | Search Results | Site Name), how to setup like this?
Also, I’m wondering if it is possible to make this string compatible with WPML in the future version, for multi-language site?
Thanks!
May 6, 2015 at 8:34 am #172227Hi,
Please provide me specific page url with issue.
Thanks
MohammadMay 6, 2015 at 8:39 am #172230This reply has been marked as private.May 6, 2015 at 9:35 am #172262Hi,
Please attach marked screenshot image to indicate your issue and provide me wordpress admin login detail.
Thanks
MohammadMay 6, 2015 at 1:41 pm #172416This reply has been marked as private.May 6, 2015 at 2:19 pm #172446Hi,
Try to add the code below in your functions.php file of the child theme
add_filter( 'wp_title', 'sf_search_filter_title', 10, 2 ); function sf_search_filter_title( $title ) { if ( is_search() ) { echo the_search_query()." |Search Results | Dante"; } else{ return $title; } }
Hope it helps.
-Rui
May 7, 2015 at 1:12 am #172588Hi Rui,
Thank you for the help, it worked like a charm!
But my site has multi-language with WPML, and the page title will stay in English this way, despite which language the user choose.
I wonder if there’s any way to accomplish this?
Is it possible to add this into future versions?
Thanks ๐
May 7, 2015 at 6:55 am #172614Hi,
Please use the code like this:-add_filter( 'wp_title', 'sf_search_filter_title', 10, 2 ); function sf_search_filter_title( $title ) { if ( is_search() ) { echo the_search_query().__('|Search Results | Dante'); } else{ return $title; } }
Now you can translate these text string through WPML.
Thanks
MohammadThanks
MohammadMay 7, 2015 at 9:34 am #172700Hi,
I’m sorry that I didn’t make it clear enough,
I meant the string “Search Result” will stay in English this way, not the string that user searched for, sorry about that.
Thank you so much ๐
May 7, 2015 at 9:40 am #172711Hi,
Its ok. No problem.
Thanks
MohammadMay 8, 2015 at 1:23 am #173022Hi Mohammad,
Is it possible to make the string “Search Result” translatable? Thanks!
May 8, 2015 at 1:47 am #173024Hi,
Its translatable. Please check my previous reply code.
Thanks
MohammadMay 15, 2015 at 2:55 am #175106Hi Mohammad,
Got it!
I didn’t know I should use the WPML “String Translation” plugin to do so, but it’s PERFECT now!
Thanks for the help ๐
May 15, 2015 at 2:59 am #175108Hi,
You most welcome.
Thanks
Mohammad -
Posted in: Dante
You must be logged in and have valid license to reply to this topic.