Tell me more ×
WordPress Answers is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Next and previous works for same category and it has option for excluding category thats fine what if i want to show next and previous for a particular category id only ???

Thank you in advance

share|improve this question

closed as too localized by toscho Jul 22 '12 at 22:58

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, see the FAQ.

1 Answer

This might help in that it will exclude the categories you do not want.

Note all four places where you input your categories to be excluded. the example id's are id=10 id=20 id=30

if (is_single() && $thesis_design->display['posts']['nav']) { 
$previous = get_previous_post(FALSE,'10,20,30'); 
$next = get_next_post(FALSE,'10,20,30'); 
$previous_text = apply_filters('thesis_previous_post', __('Previous entry: ',  'thesis')); #filter 
$next_text = apply_filters('thesis_next_post', __('Next entry: ', 'thesis'));   #filter 

if ($previous || $next) { 
    echo "\t\t\t\t\t<div class=\"prev_next post_nav\">\n"; 

    if ($previous) { 
        if ($previous && $next) 
            $add_class = ' class="previous"'; 

        echo "\t\t\t\t\t\t<p$add_class>$previous_text"; 
        previous_post_link('%link', '%title',FALSE,'10,20,30'); 
        echo "</p>\n"; 
    } 

    if ($next) { 
        echo "\t\t\t\t\t\t<p>$next_text"; 
        next_post_link('%link', '%title',FALSE,'10,20,30'); 
        echo "</p>\n"; 
    } 

    echo "\t\t\t\t\t</div>\n"; 
   } 
  } 
} 
share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.