Yukon Cornelius
Member
Posted 1 year ago #
Hi,
I am trying to exclude posts from two categories from showing in my previous/next navigation links with the following code, but post in 8 and 62 still seem to be showing.
`<div class="navigation">
<div class="next-posts"><?php next_posts_link('« Older Entries', '%title', FALSE, '8 and 62') ?></div>
<div class="prev-posts"><?php previous_posts_link('« Older Entries', '%title', FALSE, '8 and 62') ?></div>
</div>`
Can anyone see where I'm going wrong?
Thanks,
Jimmy
Yukon Cornelius
Member
Posted 1 year ago #
the red bicycle
Member
Posted 1 year ago #
I found the above usefull to a certain point..Is it possible to limit the categories excluded using a query
<?php
if ( is_cat=1() ) {
query_posts( 'cat=-2,-3' )
if ( is_cat=2() ) {
query_posts( 'cat=-1,-3' )
if ( is_cat=3() ) {
query_posts( 'cat=-1,-2' )
I would like to use this to include only posts from the same category from showing up in the single post template next/previous link.
Thanks a bucket
same category from showing up in the single post template next/previous link.
http://codex.wordpress.org/Function_Reference/next_post_link
http://codex.wordpress.org/Function_Reference/previous_post_link
'in_same_cat' paramter
conditional tags
http://codex.wordpress.org/Conditional_Tags
(is_category() would not work in single.php; try in_category() )
the red bicycle
Member
Posted 1 year ago #
I found the documentation for next_post_link very usefull. Made me thank Wp for being so adaptable. And thanks to you for your response.