I have been using the same pagination query for the majority of the websites i have created. This time it is not working for some reason I have used the pagination trouble shooting links Here but nothing seems to be working. I have attached my code below.
This time i am querying the post in a table so i think that must have something to do with it but i have queried it without a table and is still not working. Please see my code below.
New query
<?php
$args = array(
'post_type' => 'custom_post_type',
'posts_per_page' => 5,
'paged' => ( get_query_var('paged') ? get_query_var('paged') : 1),
);
query_posts($args);
?>
The table with my table data from my custom meta fields.
<table>
<thead >
<tr>
<th>header</th>
<th>header</th>
<th>header</th>
<th>header</th>
</tr>
</thead>
<tbody>
<?php while (have_posts()) : the_post();?>
<tr>
<td><?php echo get_post_meta($post->ID, 'metakey', true); ?></td>
<td><?php echo get_post_meta($post->ID, 'metakey', true); ?></td>
<td><?php echo get_post_meta($post->ID, 'metakey', true); ?></td>
<td><?php echo get_post_meta($post->ID, 'metakey', true); ?></td>
</tr>
<?php
endwhile;
?>
</tbody>
</table>
My pagination links
<?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=%#%',
'prev_text' => __(' Previous'),
'next_text' => __('Next '),
'current' => max( 1, get_query_var('paged') ),
'total' => $wp_query->max_num_pages
) );
?>
When I say its not working i mean that the pagination links are displayed the appropriate number of pages. but when i press on page two it isnt changing pages. the permalinks are right its says domain/page/2
but the page is the same as page one. This is on a template page i created for home-page.php
I appreciate the suggestions.