0

I'm using wpml string translation on my main site, which pulls content from the other blogs, by doing a blog switch. This successfully gets english posts from the other sites if my main site is in english mode, and it gets danish posts from the other sites if my main site is in danish mode. However, the string translation does not happen, and "MORE INFO" appears regardless of the current language settings. I have done a dump of the constant ICL_LANGUAGE_CODE in the while loop and it is danish or english depending on which language my main site is currently in. So why does wpml not run string translation>

$blog_list = wp_get_sites( 0, 'all');

foreach ($blog_list as $blog)
{
    switch_to_blog($blog['blog_id']);
    $the_query = new WP_Query( array(
    ...
    ));

    if($the_query->have_posts())
    {
        while ( $the_query->have_posts() ) 
        {
            $the_query->the_post();
        ?>
<div class="more_info current_blog_bg_sixth">
    <a href="#">
      <span><?php _e('MORE INFO', 'my-domain') ?></span>
    </a>
</div>

        } //close while

    } //close if
    restore_current_blog();
} //close foreach
  • Did you figure this out? – Talasan Nicholson Feb 4 '16 at 20:58
  • @TalasanNicholson I can't remember, it was a while ago. Sorry. I think it had to do with the string translations not being present on all the multi sites. I only had it on my main, and that is not enough. – Satbir Kira Feb 10 '16 at 14:02

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.