Taxonomy Terms limit pagination on single template – cannot get it to work
-
Hi,
I’ve created a custom post type cc_porfolio which has the following taxonomy associated with it portfolio_cat – the portfolio items are them categorised using the the following custom terms theatre, opera, events..I’ve set up the following code in fuctions to allow me to create a single template for aone these terms i.e single-theatre.php which works perfectly.
add_filter('single_template', 'single_template_terms'); function single_template_terms($template) { foreach( (array) wp_get_object_terms(get_the_ID(), get_taxonomies(array('public' => true, '_builtin' => false))) as $term ) { if ( file_exists(TEMPLATEPATH . "/single-{$term->slug}.php") ) return TEMPLATEPATH . "/single-{$term->slug}.php"; } return $template; }
Within that template im using the usual pagination
<nav class="next-prev-links"> <p><?php previous_post_link('%link', '<span>« Previous:</span> %title', FALSE); ?></p> <p><?php next_post_link('%link', '<span>Next: »</span> %title', FALSE); ?></p> </nav>
This works, however it doesnt limit to just the theatre term, once the lat theatre post has been reached it moves on to the next term.
Is there anyway i can get the pagination just to limit to its specific term.Hope tha makes sense, Many many thanks in advance
- The topic ‘Taxonomy Terms limit pagination on single template – cannot get it to work’ is closed to new replies.