• 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 15 replies - 1 through 15 (of 21 total)
  • Thread Starter lvsn

    (@lvsn)

    sorry, I mean WordPress 3.5 not 5.2, of course.

    Plugin Author Chouby

    (@chouby)

    What was the previous version of Polylang? Did you check for any other plugin conflict or even a conflict with the theme?

    Thread Starter lvsn

    (@lvsn)

    Deleted the 0.9.8 version, because it screwed up my media library (could not see the images to add to posts). Tried to install many of the previous versions, but at the top of my website I got

    Warning: Missing argument 2 for wpdb::prepare(), called in /home/content/47/8501247/html/wp-content/plugins/polylang/include/base.php on line 214 and defined in /home/content/47/8501247/html/wp-includes/wp-db.php on line 990

    Warning: Missing argument 2 for wpdb::prepare(), called in /home/content/47/8501247/html/wp-content/plugins/polylang/include/base.php on line 216 and defined in /home/content/47/8501247/html/wp-includes/wp-db.php on line 990

    Theses messages dissapear if I install the later version of Polylang, but as I said this version screws up everything.

    Plugin Author Chouby

    (@chouby)

    You came into an issue that new versions are compatible with old versions, but the opposite is not true. That’s the reason for the warning.

    Media do not disappear but in 0.9+, you have to assign them a language. If not, they are not displayed.

    Of course I imagined that not everybody would need to assign a language to media so there is an option to remove this functionnality.
    Just add:
    define('PLL_MEDIA_SUPPORT', false);
    in your config.php

    This is described at the end of the documentation

    Thread Starter lvsn

    (@lvsn)

    So, I am back in my topic…

    Thank You, Chouby. Your solution for the gallery helped and everything seems ok (if smth else occurs on this matter, I will inform You).

    But there still is a problem with posts in two languages, maybe it’s the same as the other user mentioned in a similar topic. When I choose any of the categories on my menu, everything is the ok with the languages, it’s just the hompeage.

    As I am not good in coding, I can not tell if there is a conflict with the theme. I am using TheNews theme from FlexiThemes. If neccessary, I can only ask about it on their support forum.

    Plugin Author Chouby

    (@chouby)

    No need to dive into the code to detect conflicts. Just test with a default theme (twenty ten for example) and with other plugins de-activated. Then switch to your theme and activate other plugins one by one.

    Thread Starter lvsn

    (@lvsn)

    Tried twenty eleven. I did not even de-activated the plugins, and the theme was showing the correct posts for each language. So, looks like it is TheNews theme.

    Plugin Author Chouby

    (@chouby)

    Let’s try to discover how this theme breaks Polylang…

    Could you put this debug info in the file polylang/include/core.php:

    echo '<!-- dbginfo in:';
    print_r($query->query_vars);
    echo '-->';

    at line 392 just below the line:

    function pre_get_posts($query) {

    and:

    echo '<!-- dbginfo out:';
    print_r($query->query_vars);
    echo '-->';

    at line 512 just above the line:

    return $query;

    Thread Starter lvsn

    (@lvsn)

    did that.
    now I have the blank page with the text

    Warning: Cannot modify header information – headers already sent by (output started at /home/content/47/8501247/html/wp-content/plugins/polylang/include/core.php:392) in /home/content/47/8501247/html/wp-includes/pluggable.php on line 876

    Plugin Author Chouby

    (@chouby)

    ??
    Let’s try another way to display correctly this info.
    Replace the first 3 lines by:

    $GLOBALS['pll_debug'] .= '<!-- dbginfo in:' . print_r($query->query_vars, true) . '-->';

    And the other 3 by:

    $GLOBALS['pll_debug'] .= '<!-- dbginfo out:' . print_r($query->query_vars, true) . '-->';

    Create a text file called pll-debug.php
    Copy paste this:

    <?php
    /*
    Plugin name: debug info for Polylang
    */
    
    global $pll_debug;
    
    if (!is_admin()) {
    	add_action('wp_head', 'my_wp_head');
    }
    
    function my_wp_head() {
    	echo $GLOBALS['pll_debug'];
    }

    upload it in your plugins directory and activate the plugin.

    Thread Starter lvsn

    (@lvsn)

    Done.
    The site is back, but the problem is still there.

    Thread Starter lvsn

    (@lvsn)

    I uploaded the file in the Plugins directory, or should I have uploaded it to the Polylang folder?

    Plugin Author Chouby

    (@chouby)

    The intention is not to solve the problem yet but first to understand what happens. The modifications I asked are here just to display information I hope will be useful.

    You shoud upload to wp-content/plugins/
    Did you activated the plugin “debug info for Polylang”? I don’t see its output.

    Thread Starter lvsn

    (@lvsn)

    Sorry. Now it’s activated.

    Plugin Author Chouby

    (@chouby)

    OK. You can remove all this (debug info plugin and modifications done in the file core.php). Everything is working as expected so we will have to look for something else, and dive into the code of your theme. I hope the theme is not too complex to find what I am looking for.

    In your theme directory, look for the file “front-page.php”. If it does not exist look for “home.php”. If it does not exist look for “index.php”.

    Open the file and search for “query_posts” or “get_posts”. Do you find something like this?

    Edit: I tried to look at the Flexithemes website. The theme documentation is not public and eveven reading the support forum is not public ??

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