My pagination links are failing for a custom post type here http://mjw.view-wireframes.com/about-us/press/
the page reloads http://mjw.view-wireframes.com/about-us/press/page/2/ but this has no effect on the displayed posts. Flushing the permalink structure has no effect so my guess is the problem is in the query.
<?php
$paged = (get_query_var('paged')) ? get_query_var('paged') : 10;
$temp = $wp_query;
$wp_query= null;
$wp_query = new WP_Query();
$wp_query->query(array( 'post_type' => 'press',
'orderby' => 'post_date',
'posts_per_page' => $paged,
));
while ($wp_query->have_posts()) : $wp_query->the_post();
// The following determines what the post format is and shows the correct file accordingly
$format = get_post_format();
get_template_part( '/lib/includes/post-formats/'.$format );
if($format == '')
get_template_part( '/lib/includes/post-formats/standard' );
endwhile;
global $wp_query;
$big = 999999999; // need an unlikely integer
echo paginate_links( array(
'base' => str_replace( $big, '%#%', get_pagenum_link( $big ) ),
'format' => '?paged=%#%',
'current' => max( 1, get_query_var('paged') ),
'total' => $wp_query->max_num_pages
) );
$wp_query = null; $wp_query = $temp; ?>
Pagination function
<?php $wp_query = null; $wp_query = $temp;?>
function pagination($pages = '', $range = 4)
{
$showitems = ($range * 2)+1;
global $paged;
if(empty($paged)) $paged = 1;
if($pages == '')
{
global $wp_query;
$pages = $wp_query->max_num_pages;
if(!$pages)
{
$pages = 1;
}
}
if(1 != $pages)
{
echo "<div class=\"theme-pagination\"><ul><li><span>Page ".$paged." of ".$pages."</span></li>";
if($paged > 2 && $paged > $range+1 && $showitems < $pages) echo "<li><span><a href='".get_pagenum_link(1)."'>« First</a></span></li>";
if($paged > 1 && $showitems < $pages) echo "<li><span><a href='".get_pagenum_link($paged - 1)."'>‹ Previous</a></span></li>";
for ($i=1; $i <= $pages; $i++)
{
if (1 != $pages &&( !($i >= $paged+$range+1 || $i <= $paged-$range-1) || $pages <= $showitems ))
{
echo ($paged == $i)? "<li><span class=\"current\">".$i."</span></li>":"<li><span><a href='".get_pagenum_link($i)."' class=\"inactive\">".$i."</a></span></li>";
}
}
if ($paged < $pages && $showitems < $pages) echo "<li><span><a href=\"".get_pagenum_link($paged + 1)."\">Next ›</a></span></li>";
if ($paged < $pages-1 && $paged+$range-1 < $pages && $showitems < $pages) echo "<li><span><a href='".get_pagenum_link($pages)."'>Last »</a></span></li>";
echo "</ul></div>\n";
}
}