0

I found a lot of way to paginate posts but what I didnt find is that if it is possible to have a pagination between pages.

I am looking for a plugin which set pagination at the bottom, and I could set a page for each pagination item. For example number 1 and number 2 would be a completely different page.

Does anyone tried to achieve this behaviour?

Mátyás Grőger
  • 1,207
  • 2
  • 13
  • 24

1 Answers1

1

You could something like this (based on this answer):

$the_query = new WP_Query(
    array(
        'posts_per_page'=>30,
        'post_type'=>'page',
        'paged' => get_query_var('paged') ? get_query_var('paged') : 1)
);

$big = 999999999; // need an unlikely integer
echo paginate_links( 
    array(
        'base' => str_replace( $big, '%#%', get_pagenum_link( $big ) ),
        'format' => '?paged=%#%',
        'current' => max( 1, get_query_var('paged') ),
        'total' => $the_query->max_num_pages
    ) 
);

wp_reset_postdata();
Cray
  • 5,307
  • 11
  • 70
  • 166
  • and how do I set which pages it should paginate over – Mátyás Grőger Feb 25 '22 at 12:39
  • That's not possible with the code except you add them manually with `'post__in' => $ids` for example – Cray Feb 25 '22 at 12:42
  • In the WP_Query parameter? – Mátyás Grőger Feb 25 '22 at 12:46
  • 1
    yes, you could add an list of ID's there – Cray Feb 25 '22 at 12:49
  • I created a short code for your code, and then added this shortcode via elementor to the page. I see the rendered pagination when I am in the elementor-edit-view, but not when I am watching the page normally. Do you have maybe some idea how to correctly show your code? – Mátyás Grőger Feb 25 '22 at 13:02
  • 1
    Sorry, I have no idea how Elementor works. But wouldn't it be better to use a custom menu for that: https://elementor.com/blog/introducing-nav-menu/ – Cray Feb 25 '22 at 13:09
  • You are right, maybe having a menu where the navigation names are numbers instead of the page names, and then adding some css to show it like pagination is the easiest approach, thank you very much for that idea – Mátyás Grőger Feb 25 '22 at 13:16