New Landing How can we help? Themeforest Theme Support Dante How to change the page title srting for search result page "You searched for"?

Viewing 14 posts - 1 through 14 (of 14 total)
  • Posted in: Dante
  • #172213
    fionalu
    Member
    Post count: 45

    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!

    #172227
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    Hi,
    Please provide me specific page url with issue.
    Thanks
    Mohammad

    #172230
    fionalu
    Member
    Post count: 45
    This reply has been marked as private.
    #172262
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    Hi,
    Please attach marked screenshot image to indicate your issue and provide me wordpress admin login detail.
    Thanks
    Mohammad

    #172416
    fionalu
    Member
    Post count: 45
    This reply has been marked as private.
    #172446
    Rui Guerreiro – SUPPORT
    Keymaster
    Post count: 25779

    Hi,

    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

    #172588
    fionalu
    Member
    Post count: 45

    Hi 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 ๐Ÿ™‚

    #172614
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    Hi,
    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
    Mohammad

    Thanks
    Mohammad

    #172700
    fionalu
    Member
    Post count: 45

    Hi,

    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 ๐Ÿ™‚

    #172711
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    Hi,
    Its ok. No problem.
    Thanks
    Mohammad

    #173022
    fionalu
    Member
    Post count: 45

    Hi Mohammad,

    Is it possible to make the string “Search Result” translatable? Thanks!

    #173024
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    Hi,
    Its translatable. Please check my previous reply code.
    Thanks
    Mohammad

    #175106
    fionalu
    Member
    Post count: 45

    Hi 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 ๐Ÿ™‚

    #175108
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    Hi,
    You most welcome.
    Thanks
    Mohammad

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

You must be logged in and have valid license to reply to this topic.

License required for the following item
Login and Registration Log in · Register