• Resolved yahiaaboushadi

    (@yahiaaboushadi)


    I have a site in English that is translated into Japanese and Simplified Chinese using Lingotek and Polylang. However, when I use your plugin, it looks like the English blog posts are showing up on the translated dimensions, and vise versa:

    https://4cs-uat.gia.edu/en-us/blog/
    https://4cs-uat.gia.edu/zh-cn/%E5%8D%9A%E5%AE%A2/
    https://4cs-uat.gia.edu/ja-jp/%E3%83%96%E3%83%AD%E3%82%B0/

    That is a problem because I need it to be locale specific. I can’t have mixed content/languages.

    In case you are wondering, this is a sandbox environment, not production, so you will see several php errors on the front end. I am aware of these error.

    Just FYI, I have the code in a file called featured.php which affects the slider and the “Popular Posts” section. This is the code I’m using:

    <?php
    $args = array(
         'limit' => 4,
          'range' => 'all',
         'order_by' => 'views',
         'post_type' => 'post',
          'thumbnail_width' => 330,
        'thumbnail_height' => 167,
         'stats_views' => 1,
          'stats_category' => 1, 
          'post_html' =>'
          <article class="blog-post featured-post">
          <header>
                <span class="info">Views: {views}</span>
              <figure>
              {thumb}
              </figure>
            
              <ul class="categories">
                <li>{category}</li>
              </ul>
            
            <h3>{title}</h3>
            
          </header>
        </article>'
    );
    wpp_get_mostpopular( $args );
    ?>

    Any help would be greatly appreciated.

    The page I need help with: [log in to see the link]

Viewing 12 replies - 1 through 12 (of 12 total)
  • Plugin Author Hector Cabrera

    (@hcabrera)

    Hi @yahiaaboushadi,

    Is WPP’s Data Caching enabled, by any chance? (Settings > WordPress Popular Posts > Tools, under Data)

    Thread Starter yahiaaboushadi

    (@yahiaaboushadi)

    Yes, data caching is enabled.

    I do have Akamai caching and cleared the cache for the blog page. If you were not seeing the popular posts showing, it should now.

    The language issue is still a problem.

    Plugin Author Hector Cabrera

    (@hcabrera)

    Try setting Data Caching to disabled and check again. If I’m right, that should fix the problem (and that also means there’s a bug in WPP’s caching mechanism).

    Also, since you’re using a caching plugin how are you going to prevent it from caching the HTML output of the wpp_get_mostpopular() template tag?

    Thread Starter yahiaaboushadi

    (@yahiaaboushadi)

    I disabled data caching, but still running into the same issue.

    To address your question, Akamai caching isn’t through a plugin, but a premium CDN. As I’m logged into the back-end of WordPress caching rules don’t apply so any change I make will immediately show up. Its only if I’m logged out of WordPress that Akamai caching kicks in. Whether I’m logged in or out, it doesn’t seem to matter after changing the data caching setting.

    Thread Starter yahiaaboushadi

    (@yahiaaboushadi)

    Do you have any suggestions on preventing the html output of wpp_get_mostpopular() from being cached?

    Plugin Author Hector Cabrera

    (@hcabrera)

    I disabled data caching, but still running into the same issue.

    Works for me with Data Caching disabled:

    Popular Posts, English language active

    Popular Posts, Spanish language active

    Also, keep in mind that if a given post doesn’t have a translation available in the currently active language (eg. English) WPP will return the original one instead, as shown in the picture below:

    Untranslated Japanase post is being displayed on the popular posts list when current language is English

    Do you have any suggestions on preventing the html output of wpp_get_mostpopular() from being cached?

    You’d have to load your popular items via AJAX to circumvent caching.

    Thread Starter yahiaaboushadi

    (@yahiaaboushadi)

    Each one of our translated blog posts have an English master asset. The blog you have circled has an English page associated with it.

    Plugin Author Hector Cabrera

    (@hcabrera)

    Unless you can provide more details (site configuration, sample data, etc) so I can help you debug, all I can do at this point is guess. As shown on the screenshots I shared earlier, WPP worked as expected on my tests so it must be something else on your side.

    Thread Starter yahiaaboushadi

    (@yahiaaboushadi)

    I’m using Polylang and Lingotek plugins for translations.

    Do you know anyway in the code to force only the specific language of the locale? For instance, in Polylang’s pll_current_language( ); function pulls the current language. I was trying to play with it, with no success so far.

    Plugin Author Hector Cabrera

    (@hcabrera)

    WPP uses that function internally to detect the current language. That’s how it knows if it has to translate the posts or not, and if it has to then WPP uses Polylang’s built-in functions to do so. You can check the source code of the plugin on Github if you’re curious.

    Thread Starter yahiaaboushadi

    (@yahiaaboushadi)

    For some reason I’ve tried everything for the site to work, but I’ve had no luck.

    If I was to add a conditional like: <?php if (!is_front_page() and pll_current_language() == 'ja-jp' ): ?> , is there a way to leverage wpp_get_mostpopular(); with pll_current_language(); so that I can run wpp_get_mostpopular() but force the pll_current_language() function?

    Plugin Author Hector Cabrera

    (@hcabrera)

    No, unfortunately there’s no way to do that. As I mentioned before, WPP detects the current language automatically.

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘English posts showing up on Chinese and Japanese dimensions’ is closed to new replies.