Navigation
This is archived content. Visit our new forum.
  • Author
    Posts
  • #116331

    ming
    Participant

    Hi,

    trying to setup a multi-language page with WPML I found, that the Search Results Page is not working properly for the second language.

    The page shows the whole pages instead of short search results!

    WPML is setup to use directories for the different languages:
    http://www.example.com – for main language
    http://www.example.com/it/ – for second language

    How to fix that?

    thanks!

    #116353

    Kosher K
    Member

    Hi There,

    Can you please provide URL of your site, screenshot of the issue and additional details.

    You can also provide login access to your site so we can check on your set-up

    Thank you

    #116582

    ming
    Participant
    This reply has been marked as private.
    #116738

    Rad
    Moderator

    Hi there,

    You have to create your post translation. It’s shows empty because your posts does not have language equivalent of your another language. You can check WPML documentation for more info.

    Though, I’m getting some error from your admin page. You can try disabling all your plugin and enable them one by one while checking what causing it. This is more on 3rd party plugin issue like WPML so you may need to contact them first.

    Thanks!

    #116997

    ming
    Participant

    Hi again,

    some posts have a test translation. This is definitely not the problem.
    please try to search for example “TMP” in both languages and compare the results-page.

    Error:
    Only found one error:
    Warning: uasort() [function.uasort]: Array was modified by the user comparison function in /data/…/wp-includes/class-wp-theme.php on line 1208
    Seems to be php bug:

    usort() [function.usort]: Array was modified by the user comparison function are due to a known php bug. See php bug #50688 for more information. This warning does not affect the functionality of your site and it is not visible to your users.
    https://bugs.php.net/bug.php?id=50688

    thanks

    #117499

    Rad
    Moderator

    Hi there,

    There is no TMP for both language. All you have is a Hello World post. Could be that we’re looking on different site?

    Would you mind providing your ftp login too? I’d like to check your search template too.

    Thanks!

    #117559

    ming
    Participant
    This reply has been marked as private.
    #117693

    Rad
    Moderator
    This reply has been marked as private.
    #117957

    ming
    Participant
    This reply has been marked as private.
    #118033

    ming
    Participant

    Hi there,

    just found that the home-template changes the search results page for the secondary language!

    Blank – No Container Header, Footer –> broken searchs result page
    Layout – Content left, Sidebar right –> nice search results page

    cheers

    #118175

    Rad
    Moderator

    Okay cool! Great to hear that 🙂

    #118187

    ming
    Participant

    Not so cool!

    I guess thats not the way it should be!? I want to be free on choosing my template for home-site without influencing the look of my search-results page!!

    #118287

    Rad
    Moderator

    Hi there,

    Sorry for the confusion, I thought you decided to use different page template.

    X does not dictate WPML plugin what template to use, but it’s WPML that decide which one. Apparently it’s choosing the template used for home page.

    WPML is picking the blog page ID from Admin > Settings > Reading > Front page displays > Posts page. Then it pulls the template used for that specific page. You can verify this by setting Posts page to none, and since it’s none then WPML won’t detect any ID. And it will use the default template (index.php), though, that will unset your blog too.

    I tried all possible setup and it’s not working. WordPress has search template but if it’s unavailable then it will use index.php. But WPML override that default behavior. You have to contact WPML author.

    For the meantime, add this code at your child theme’s functions.php

    add_filter( 'template_include', 'force_template_override', 99 );
    
    function force_template_override( $template ) {
    
      if( is_search() ) {
        $p = pathinfo($template);
        return $p['dirname'].'/index.php';
      }
    
      return $template;
    }

    Thanks!

    #118351

    ming
    Participant

    Hi there,

    this solution works perfect!!

    Anyway – I’ll contact WPML regarding this behavior.

    Thanks for your fast and professional support!

    #118470

    Christopher
    Moderator

    You are welcome 🙂