• Resolved lvsn

    (@lvsn)


    I was using older version of Polylang with WordPress 3.4.2. It was all fine, until today I updated WordPress to 5.2 and also got the latest Polylang version. And now I got the problem with my starting page, there are posts in both languages, but should be only in one, depending on which version (Latvian or English) of the site is currently used.

    You can have a look at the website – lv-snooker.com

    https://www.ads-software.com/extend/plugins/polylang/

Viewing 6 replies - 16 through 21 (of 21 total)
  • Thread Starter lvsn

    (@lvsn)

    I have index.php

    There is query_posts at the start of the code

    <?php global $theme; get_header(); ?>
    
        <div id="main">
        <?php $theme->hook('main_before'); ?>
    
            <div id="wrap-content">
            <?php $theme->hook('content_before'); ?>
    
                <div class="content">
                    <?php
                        if(is_home()) {
                            $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
                            $build_homepage_query = array (
                    		   'paged'=> $paged,
                    		   'category__not_in' => $theme->get_option('homepage_exclude_categories'),
                               'posts_per_page' => $theme->get_option('homepage_posts_per_page')
                    		);
                            query_posts($build_homepage_query);
                        }
    
                        $theme->options['template_part'] = 'homepage';
                        get_template_part('loop', 'homepage');
                    ?>
                </div><!-- .content -->
    
            <?php $theme->hook('content_after'); ?>
            </div><!-- #wrap-content -->
    
            <?php get_sidebar(); ?> 
    
        <?php $theme->hook('main_after'); ?>
        </div><!-- #main -->
    
    <?php get_footer(); ?>
    Thread Starter lvsn

    (@lvsn)

    I posted on their support forum yesterday, but haven’t got an answer yet. Probably I should wait after New Year holidays are over.

    Plugin Author Chouby

    (@chouby)

    I am not 100% sure it is the only reason of the conflict with Polylang, but here your theme does not care of what is in the query and create its own new query, completeley overwriting what could be done by plugins.

    Could you add this line

    $build_homepage_query = array_merge($GLOBALS['wp_query']->query_vars, $build_homepage_query); // don't reset other query_vars!

    just above:

    query_posts($build_homepage_query);

    Thread Starter lvsn

    (@lvsn)

    Hey, it worked! Now the site is back to normal. Thank you!

    Thread Starter lvsn

    (@lvsn)

    So, this is now resolved. Thanks again and happy New Year, Chouby.

    Plugin Author Chouby

    (@chouby)

    Great! You should suggest to the theme developper to include the modification in the next theme update as it will likely break other plugins. Happy New Year to you too!

Viewing 6 replies - 16 through 21 (of 21 total)
  • The topic ‘Homepage shows posts in both languages’ is closed to new replies.