第一页显示第一个结果,但是,mypages/page2导致404错误。以下代码位于存档mypages中。php
<?php
$temp = $wp_query;
$wp_query=null;
$args = array(
\'post_type\' => array ( \'reports\', \'results\', \'reports-drop\',\'reports-snap\'),
\'post_status\' => \'publish\',
\'paged\' => $paged,
);
$wp_query = new WP_Query( $args );
if ( $wp_query -> have_posts() )
{
while ($wp_query->have_posts()) : $wp_query->the_post();
?>
<a target="blank" href="<?php the_permalink(); ?>">The Link</a>
<?php
endwhile;
}
else
{
echo \'no files found\';
}?>
Page: <?php echo paginate_links(array(
\'base\' => \'http://mywebsite.com/mypages/%_%\',
\'format\' => \'page/%#%\',
\'current\' => (get_query_var(\'paged\') ? get_query_var(\'paged\') : 1),
\'prev_next\' => false,
\'total\' => $wp_query->max_num_pages,
\'mid_size\' => 2,
\'type\' => \'plain\'
));?>
<?php
//clear again
$wp_query = null;
//reset
$wp_query = $temp;
?>