-
AuthorPosts
-
October 1, 2014 at 8:33 am #116331
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 languageHow to fix that?
thanks!
October 1, 2014 at 8:59 am #116353Hi 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
October 1, 2014 at 2:46 pm #116582This reply has been marked as private.October 1, 2014 at 6:38 pm #116738Hi 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!
October 2, 2014 at 6:39 am #116997Hi 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=50688thanks
October 2, 2014 at 2:23 pm #117499Hi 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!
October 2, 2014 at 3:19 pm #117559This reply has been marked as private.October 2, 2014 at 7:49 pm #117693This reply has been marked as private.October 3, 2014 at 8:32 am #117957This reply has been marked as private.October 3, 2014 at 9:50 am #118033Hi 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 pagecheers
October 3, 2014 at 2:12 pm #118175Okay cool! Great to hear that 🙂
October 3, 2014 at 2:28 pm #118187Not 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!!
October 3, 2014 at 7:00 pm #118287Hi 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!
October 4, 2014 at 12:55 am #118351Hi there,
this solution works perfect!!
Anyway – I’ll contact WPML regarding this behavior.
Thanks for your fast and professional support!
October 4, 2014 at 10:13 am #118470You are welcome 🙂
-
AuthorPosts