Skip to main content
2 of 3
deleted 29 characters in body
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
$big = 999999999; 
    
    $pagination = paginate_links( array(
        'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),
        'format' => '?paged=%#%',
        'current' => max( 1, get_query_var('paged') ),
        'total' => $this->query->max_num_pages
    ) );
    
    $html .= $pagination;
?>

enter image description here

KC Chai
  • 55
  • 2
  • 13