Recurring puzzle with Looper Providers using Query Builder (pagination)

Hello, we’ve browsed forum posts where people had similar issues, but we can’t find the clean/proper way to achieve a pagination that considers the Query Builder.

We have a layout with a Looper Provider that filters out some posts based on a meta value.
As soon as the Query Builder is enabled, the Post Pagination element doesn’t keep up (which is most likely an expected behavior).

What is the clean way to add a pagination to a Query Buildered Looper Provider using Pro?

–Extra info and screenshots–

The pagination element seems to detect the right quantity, but the page doesn’t filter properly and always shows the same elements (see page numbers VS shown posts):


Hello @magikweb,

Thank you for the inquiry.

You may need to manually create pagination for the Looper Provider using the available looper data, such as the page and post count. This was discussed in the following thread.

Twig Example: Pagination for Looper Providers (finally!)

Let us know if you need more info.

Best regards.

Thanks for the follow-up! That other thread isn’t clear to me for our context. I asked one of our dev to attempt building a self-made pagination following that information and we’ll get back to you if we succeed (or fail).

We’ll keep the thread open. If you need assistance with this type of modification, please check out the One service.

Hello,
I have tried the “{{ ({dc:query:current_page}-1)*9 }}” and also with the twig, both doesn’t work. Also, can we get a component that doesn’t depend absolutely of the settings/reading setup?

The only thing that works is by using “By Page” in the recent post so the post pagination follow up.

But if we need a second post tiles, it doesnt work properly because we have to change again the number of article in the setting/reading.

Thanks for your help !

Unfortunately, this will require modifications that are beyond the scope of our support. As mentioned above, you may want to consider availing of our One service. If you can provide the site URL and login details in the secure note, we’ll try to take a closer look.

Best regards.

Finally I created an account for you (look at secure note). You can use the Test PO site with cornerstone, blogs are in the archive layout. Everything works if we dont use the NOT Events.(Taxomonies).

https://www.magikweb.net/test-po/wp-admin/

Best regards.

Thank you for the inquiry.

We adjusted the Looper Provider in the accueil page, then added this Twig template to create the pagination.

{% set current_page = query.current_page_zero + 1 | default(1) %}
{% for i in 1..looper.total_pages %}
    {% if i == current_page %}
        <span class="page current">{{ i }}</span>
    {% else %}
        <a class="page" href="https://www.site.net/test-po/accueil/page/{{ i }}">{{ i }}</a>
    {% endif %}
{% endfor %}

Link in the secure note.

Hello,
should have more than 2 pages since we got 13 articles. So it doesn’t work properly (there is 3 “événements” in taxonomies") There is 7, 4, and 3 that are event categories.


thanks for your help.

We adjusted the Looper Provider further to order posts by date. This has fixed the issue with the missing posts. Please make sure to purge the cache before checking.

Thanks, it works properly, we saved the template to put that in the archive layout. But we need another thing. We want that when we click on the category, only articles that are in this category should be showed. Must have a twig or something to do that.

When we click on a article’s category, we want the URL to follow but actually it doesn’t work.

The link is still avalaible (view in secure note)

Thanks again.

Hello @magikweb,

You only have 1 archive layout. You are using this for the blog index and for the category archive layout. This does not work because of the Looper Provder present.

As long as you use the archive layout for the blog index and any of the archive pages of the site WITHOUT the presence of the Looper Provider, it should display the correct items and the Pagination will work.

If in case, you want to EXCLUDE a particular category or taxonomy from the blog index, we highly recommend that you use custom HP code like the one mentioned on these threads;

Having to do it this way, you prevent any conflicts and further conflicts as you go on building the site. Because if you continue what you are currently doing, even if the Twig code from @Ismael is working, you will encounter hurdles with your design as you go into building the archive pages.

Hope this makes sense.