Skip to main content
1 of 3
KC Chai
  • 55
  • 2
  • 13

Wordpress Blog Posts with Pagination inside a Page/Post

Refer to the title, I'm trying to create a shortcode for Blog Post with Pagination. I'm able to show the blog post but the pagination is not working. I tried using the code below and the link to second page is www.mysite.com/postname/page/2 . But it goes back to www.mysite.com/postname/ when I click on the pagination link to second page.

<?php
global $wp_query;

$big = 999999999; // need an unlikely integer

echo paginate_links( array(
    'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),
    'format' => '?paged=%#%',
    'current' => max( 1, get_query_var('paged') ),
    'total' => $wp_query->max_num_pages
) );
?>
KC Chai
  • 55
  • 2
  • 13