• Resolved jorge-vitrubio

    (@jorge-vitrubio)


    alm works properly without polylang but is is not responding to the language, it will load all articles without considering the taxonomy.

    this is the code that I am using.

    <!--load more pagination-->
                    <?php
                        $the_tax = get_taxonomy( get_query_var( 'taxonomy' ) );
                        $term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) );
                        echo '<div class="row">';
                        echo do_shortcode('[ajax_load_more post_type="service_egv" taxonomy="type_service_egv" taxonomy_terms="'.$term->slug.'" repeater="repeater2" offset="12" posts_per_page="8" scroll="false" pause="true" button_label="+"] ');
                        echo '</div>';
                    ?>

    I believe it is not alm error but maybe you have already had this issue (which I couldn’t find)

    all software is up to date wp 4.0.1 polylang 1.6.1 alm 2.6.1

    https://www.ads-software.com/plugins/ajax-load-more/

Viewing 11 replies - 1 through 11 (of 11 total)
  • Plugin Author Darren Cooney

    (@dcooney)

    Hi jorge,
    I’ve never used Polylang so the plugin definitely is not set up to handle those lang variables.

    Do you know how I would retrieve the current language in the plugin?
    with WPML the ICL_LANGUAGE_CODE with return the current language.

    Cheers.

    Thread Starter jorge-vitrubio

    (@jorge-vitrubio)

    Hi dcooney

    first, thank you for your help and cool plugin.

    in the Polylang plugin, for what i see, the language is retrieved with pll_current_language() [1]

    pll_current_language($value);
    ‘$value’ => (optional) either ‘name’ or ‘locale’ or ‘slug’, defaults to ‘slug’`

    returns either the full name, or the WordPress locale (just as the WordPress core function ‘get_locale’ or the slug ( 2-letters code) of the current language.

    best
    jorge.

    [1]https://polylang.wordpress.com/documentation/documentation-for-developers/functions-reference/

    Thread Starter jorge-vitrubio

    (@jorge-vitrubio)

    I keep on searching the solution, mean while I found this reply that might help with custom post / taxonomies and Polylang

    https://www.ads-software.com/support/topic/pods-integration-with-polylang?replies=21#post-3712356

    And here, with another plugin, is the same issue that I have now. and the author found a solution… hope it helps.

    https://github.com/pods-framework/pods/issues/974

    Plugin Author Darren Cooney

    (@dcooney)

    Ok thanks! I’m busy this week but will try to get to this as soon as I can.

    Thread Starter jorge-vitrubio

    (@jorge-vitrubio)

    Hello Darren

    I have find the solution but, i believe you have to code it on the next version of ALM.

    on the file ajax-load-more.php

    I’ve commented this
    //$lang = defined('ICL_LANGUAGE_CODE') ? ICL_LANGUAGE_CODE : '';

    and queried polylang language
    $lang = pll_get_post(('pll_current_language'));

    I don’t know how to make it work in the way that it will recognize whether we have one plugin or the other or even better, use the wp language variable.

    thank you for your great plugin, marking it as resolved

    cheers.

    Plugin Author Darren Cooney

    (@dcooney)

    Ok great!
    I can take it from here!

    Appreciate it.

    Plugin Author Darren Cooney

    (@dcooney)

    I just tested this and this does not fix the issue. In fact the ‘lang’ parameter is essentially useless when querying by custom post type or standard posts/pages.

    It appears that when querying by custom taxonomy values WP_Query() ignores the current language and just simply returns all results with that match the taxonomy terms.

    I guess a fix would be to use language specific terms?

    Thread Starter jorge-vitrubio

    (@jorge-vitrubio)

    I had the site with access only to registered members and it did work but after I opened it to all access it is not working any more.

    I wanted to check if it was my mistake before writing you.

    thanks for your effort

    jorge.

    Thread Starter jorge-vitrubio

    (@jorge-vitrubio)

    Hello Darren

    sorry but the parameter lang is not useless when querying a custom post type… I’ve just hardcoded it as explained here and works:

    <?php
    $loop = new WP_Query(array('post_type' => 'CUSTOM_POST_TYPE', 'lang' => 'TWO_LETTER_LANG_CODE'));
     while ( $loop->have_posts() ) : $loop->the_post(); ?>

    I just need to know how to put it in the loop properly

    sorry for the late reply, I couldn’t find time

    Plugin Author Darren Cooney

    (@dcooney)

    Hi Jorge,
    Ok, well I have left the lang param in ALM so we should be good there… Is there still an issue with your site?

    Thread Starter jorge-vitrubio

    (@jorge-vitrubio)

    I’ve updated the plugin but it was not doing properly for what I needed so I will check the whole code for my template and afterwards will tell you.

    thanks again
    jorge.

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘alm and polylang: loading all posts’ is closed to new replies.