I have my blog setup with a static homepage and the blog index displays on a page called “blog” (http://nnmportfolio.com/blog). I have a category called “photography” for which I recently created a separate website. As a result, I’d like to hide the photography category and its posts from the category list and blog pages but I don’t want to delete or prevent access to posts.
Given that’s its only one category I would prefer to use code rather than a plugin. I tried searching the forums and elsewhere online but the instructions and codes that I found (see below) didn’t work and I don’t have much knowledge of PHP. I’d greatly appreciate any suggestions. Thanks!
<?php if (is_front_page() && !is_paged() ) $posts = query_posts($query_string . '&cat=-35'); ?>
<?php $cat_to_exclude = 35; query_posts($query_string . '&cat=-'.$cat_to_exclude'); ?>
<?php if (in_category('35')) continue; ?>
- The topic ‘Hide / Exclude Categories From Posts Page’ is closed to new replies.