show pagination for query

Support MB Views show pagination for queryResolved

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #20952
    sofdesignesofdesigne
    Participant

    Hi, i have a query that i want to show pagination for, here is the code:

    {% set args = {post_type: 'folders', posts_per_page: '6', nopaging: false, category_name: 'en-cours' }%}
    {% set myfolders = mb.get_posts( args ) %}
    
    {% for folders in myfolders %}

    content is here

    {% endfor %}
    
    <div class="nav-previous alignleft">{{ mb.previous_posts_link( 'Older posts' ) }}</div>
    <div class="nav-next alignright">{{ mb.next_posts_link( 'Newer posts' ) }}</div>

    i added these two lines without success ! nothing displayed, any idea how to achieve this ?
    if you can also tell me how to get page numbers to put between those two buttons

    thanks

    #20958
    Long NguyenLong Nguyen
    Moderator

    Hi,

    The function get_posts() works perfectly if you are going to use a custom query that doesn't need pagination. If you want to show the pagination, please use WP_Query via PHP code to show it.

    Please follow the documentation for more information https://developer.wordpress.org/reference/functions/paginate_links/#user-contributed-notes.

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.