WordPress.org

Ready to get started?Download WordPress

Forums

Need a better way to hide categories from the index loop (4 posts)

  1. AphelionZ
    Member
    Posted 7 years ago #

    `<?php while (have_posts()) : the_post(); ?>
    <?php if (in_category('516')) continue; ?>`

    I've been using the above hack to not show category ID 516 in my main loop. It works well except now at http://outletzine.org i only have one post at a time on the front page.

    The problem is - when somebody goes to look at the previous entries (http://outletzine.org/page/2/) they are presented with a blank page where a post from category 516 would be.

    Does anybody know of a better workaround or a plugin/settings change that would prevent this from happening?

  2. AphelionZ
    Member
    Posted 7 years ago #

    any ideas?

    Even if its another thing using php syntax, i dont necessarily mind right now

  3. Samuel Wood (Otto)
    Tech Ninja
    Posted 7 years ago #

    You need the Category Visibility plugin. It does exactly what you're talking about, and doesn't have the post reduction issue.

    See here: http://ryowebsite.com/?p=46

  4. AphelionZ
    Member
    Posted 7 years ago #

    Thanks!

Topic Closed

This topic has been closed to new replies.

About this Topic