<?php
/* Template Name: Front page */
get_header();
?>
<div class="rfp_hide" id="rhm_show">
<?php
$paged = (get_query_var('page')) ? get_query_var('page') : 1;
$args = array(
'post_type' => 'product',
'page' => $paged,
'posts_per_page' => 20,
'product_cat' => '',
'orderby' => 'date',
'order' => 'DESC'
);
$loop = new WP_Query( $args );
while ( $loop->have_posts() ) : $loop->the_post();
global $post, $paged;
?>
<div class="rhm_container">
<?php echo do_shortcode('[show_post]'); ?>
</div>
<?php endwhile; ?>
<?php wp_reset_query(); ?>
<nav>
<ul>
<li><?php previous_posts_link( '« PREV', $loop->max_num_pages) ?></li>
<li><?php next_posts_link( 'NEXT »', $loop->max_num_pages) ?></li>
</ul>
</nav>
</div>
</main><!--/main content -->
<?php get_footer(); ?>
So, this is my html5blank template that I have which shows posts.
I can’t seem to be able to make the pagination work.
Well, that’s not entirely true. I can see the “Next” button at the bottom. The href is example.com/page/2
. However when I click it, it just refreshes the page and does not go to page 2.
Does anyone know why it might be like that?
Thank!