Okay
  Public Ticket #229413
Main loop pagination wpml
Closed

Comments

  • Stefano started the conversation

    Hi,

    I actually have a flavor installation with WMPL plugin for multilanguage support and basically it works fine.

    I'm experiencing some problem in the home page. When you open the webpage, and you select a language from the dropdown on the right sidebar, you see posts in the correct language.

    If you click on the page numbers to paginate or the other buttons (the ones on the top of the main loop), the content is displayed in english.

    Looking at the code, I can see that there are some ajax calls by these buttons, to functions/ajax.php file. There the query is composed to build the response, but I guess somethings is different (maybe some parameter is not passed) from the standard query since the response is different.

    I tried to do this

    $args= array_merge($args,array('suppress_filters'=>false));

    before the call to it_loop but nothing seems to change. Since the standard call works, i guess this other one for pagination is missing something...

    Any idea? 

    Thank you very much

  •  321
    Brian replied

    I believe wpml creates separate versions of each post - one for each language - is this correct? If so, do you know if it puts them in different post types? Basically you need to figure out which parameter the query needs and then add it into the json-encoded object for the query in ajax calls. I can show you where that is but you'd need to figure out what you need to add

  • Stefano replied

    Thank you Brian,

    yes please tell me where  both points where queries happen so I can compare them. After that I could handle it myself. Anyway it's strange because everywhere else in flavor, wmpl is supported fine.

  •  321
    Brian replied

    Check out inc/post-loop.php and notice on the row container there is a data attribute that contains the json encoded query - check out line 245 where it's encoded and line 247 where it is added to the data attribute:

    <div class="row<?php echo $solo; ?><?php echo $postloopcss; ?> post-loop" data-currentquery='<?php echo $current_query_encoded; ?>'>

    You can look above that in the file to find where the $current_query variable is setup. The first place it's instantiated is line 5, but then you can see depending on certain conditionals below that it is modified, like line 30 for instance.

  • Stefano replied

    Thank you.

    I fixed it adding changing the ajax call url to : functions/ajax.php?lang=<?=ICL_LANGUAGE_CODE?>

    Maybe it could help somebody else.