Home Forums Feature Requests an equivalent to pagination_links, next_posts_link and previous_posts_link


an equivalent to pagination_links, next_posts_link and previous_posts_link

  • i’ve searched the forums but i haven’t found anything. only one thread where you’ve stated that that kind of functionality isn’t implemented in acf yet. would be more than useful to see that kind of functionality in a future update. best regards r.

  • Hi @rpk

    Thanks for the request. Can you please describe how these functions would be used and where?


  • On the front-end: If the functions would behave like the three mentioned wp functions it would be already enough imho. At the moment it is impossible to get the three working with acf fields e.g. if you try to build a custom blog functionality, that you are able to either jump back and forth to the next or previous article or get a pagination like that

    on the backend: it would be more than useful if you are inspecting an object of a custom post type like projects and then would be able to jump to the next object instead of go back to the main list of objects of the custom post type and jump into the detailed view of the next object. would save a lot of time for the user in the backend.

  • Hi @rpk

    I still don’t understand how pagination would work with fields.

    Fields are attached to a post object to save custom field data. You can then load this custom field data on the front end and render it in any way you wish.

    Pagination is great for going between archive pages of posts, but it is not a normal way to view a single page or data…

    Perhaps some more explanation is needed?


  • Sorry for the delayed reply. And i have to admit my wording and explanation in my initial post wasn’t the best (maybe cuz i am still not an expert on php and wordpress matters – am still in order to learn and dive into things 😉 ) . Basically it would be already perfect to offer the functionality pagination_links, next_posts_link and previous_posts_link provides that the visitor of a webpage is able to get to the previous or next post as well as offering. Cuz so far it seems impossible to use advanced custom fields with those three native wp functions. best regards r.

  • Hi @rpk

    Perhaps what you want to do is get the ‘Next’ or ‘Prev’ post_id, then you can use that post_id to load an ACF value from the specific post.


  • Yes for example. As i said basically i am unsure what would be the most elegant solution to head for with acf but basically i would like to have two options. On one hand get the link to the next or previous post_id to be able to load that specific post as you said ( like with next_posts_link and pervious_posts_link) and on the other hand to build something like on the screenshot i initially pasted, based on pagination_links. Or are both scenarios already possible in acf today and i was just blind? best regards r.

  • Hi @rpk

    Can you please be very clear as to what these ‘pagination’ buttons would do?
    So far, you have explained that they would navigate to prev / next articles. How is this any different to the already available WP functions?

    How do these navigation buttons relate to ACF fields?
    I am most confused. Please be descriptive and clear.


  • Hi @elliot

    I got a repeater that inside has a image and a file subfields, I got his on a page template, so it displays the repeaters in a grid, the question is:

    It’s possible to paginate the repeaters?
    Like it was a custom post type archive?

  • Hi Elliot,

    I have the same pagination problem as rpk, if i correctly understand what he said.
    I wil try to explain my problem as clear as possible.

    I have custom post type (flat). With custom post field (city)

    When i’m in my single post type page (single-flat) i would have navigation links to go to the next or previous flat, but i only want those with a specific city (same city as the current flat).

    In other word, how can i filter prev et next links by one or more custom post field value?


  • This is working for me.

    $paged = ( get_query_var('paged') ) ? get_query_var('paged') : 1;
    $args = array(
    	'posts_per_page' => 5,
    	'post_type' => 'faqs',
    	'paged' => $paged
    $the_query = new WP_Query( $args );
    <?php if( $the_query->have_posts() ): ?>
    	<?php while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
    		<h3><?php the_title(); ?></h3>
    		<p><em><?php the_time('F j, Y'); ?> at <?php the_time('g:i a'); ?></em></p>
    		<p><?php the_field('response'); ?></p>	
    	<?php endwhile; ?>
    <?php endif; ?>
    	<nav class="pagination">
    			$total_pages = $the_query->max_num_pages;  
    			if ($total_pages > 1){
    				$current_page = max(1, get_query_var('paged'));  
                  echo paginate_links(array(  
                      'base' => get_pagenum_link(1) . '%_%',  
                      'format' => 'page/%#%',  
                      'current' => $current_page,  
                      'total' => $total_pages, 
                      'prev_next'    => True,
                      'type' => 'plain', 
Viewing 11 posts - 1 through 11 (of 11 total)

The topic ‘an equivalent to pagination_links, next_posts_link and previous_posts_link’ is closed to new replies.