So, been reading tons of posts on here and int he Codex but just not having any luck. I have a custom post type called Work. On my portfolio page I have "posts_per_page" set to 12. In total in this custom post type I have 300 posts. I am trying to get paging working but not getting it at all.
My query:
<?php
$paged = ( get_query_var('paged') ) ? get_query_var('paged') : 1;
$all_work = new WP_Query(array(
'post_type' => 'work',
'tax_query' => array(
array(
'taxonomy' => 'type',
'field' => 'slug',
'terms' => array('case-study', 'portfolio')
),
),
'posts_per_page' => '12',
'orderby' => 'title',
'order' => 'ASC',
'update_post_term_cache' => false,
'nopaging' => false,
'paged' => 10
)
);
while ( $all_work->have_posts() ) : $all_work->the_post();
?>
My code for the pagination:
<aside id="post_nav">
<?php
global $wp_query;
$total_pages = $wp_query->max_num_pages;
if ($total_pages > 1){
$current_page = max(1, get_query_var('paged'));
echo '<div class="page_nav">';
echo paginate_links(array(
'base' => get_pagenum_link(1) . '%_%',
'format' => '/page/%#%',
'current' => $current_page,
'total' => $total_pages,
'prev_text' => 'Prev',
'next_text' => 'Next'
));
echo '</div>';
}
?>
</aside><!-- /#post_nav -->
Not getting anything though. Any help would be greatly appreciated!
Thanks!
<div class="alignleft"><?php previous_posts_link('« Previous') ?></div> <div class="alignright"><?php next_posts_link('More »') ?></div>
and changed my loop to be:'paged' => $paged