Another user on here suggested that my use of queries was incorrect so I'm changing the code. However, the pagination in the first block of code (below) isn't showing up in the HTML while the second one (my original) shows up fine.
This one doesn't work (new code):
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$loop = new WP_Query( array(
'post_type' => 'movies',
'paged' => $paged,
'posts_per_page' => 6
));
if($loop->have_posts()){
while ( $loop->have_posts() ) {
$loop->the_post();
<< LOOP GOES HERE >>
<?php
}
}
my_paginate_links();
wp_reset_postdata();
?>
This one works (my original code):
$c=0;
$i=1;
$temp = $wp_query;
$wp_query = null;
$wp_query = new WP_Query();
$wp_query->query('post_type=movies' . '&paged=' . $paged . '&posts_per_page=6');
while ( $wp_query->have_posts() ) : $wp_query->the_post(); $c++;
<< LOOP GOES HERE >>
<?php
endwhile;
my_paginate_links();
$wp_query = null;
$wp_query = $temp;
wp_reset_query();
?>
How can I get pagination to show up in the first block of code?
<?php $paged = (get_query_var('page')) ? get_query_var('page') : 1; ?>