WordPress.org

Support

Support » Your WordPress » Restrict posts to only selected category (not shown on index page)

Restrict posts to only selected category (not shown on index page)

  • i’m not quite sure if this may even be possible, but here goes! I was trying to get the posts from users to go into catagories. At the moment they all show up on the main index page.

    I have a “Youth” category on my blog, and I dont want any posts in the Youth category to be displayed on the front page. Instead i want users to have to navigate to the category page from a drop down menu i’ve got already for them to read posts. The reson for this, is that i’m not sure if everyone who visits will want to know about the things going on with the “Youth” things in my church, rather these posts, and other to be seperate

    Anyway, id like to thank anyone who reads this, and thank you so much in advance if anyone can please help me out with this issue! it will be greatly appreciated!

    -Crawf

Viewing 2 replies - 1 through 2 (of 2 total)
  • The simplistic answer is just to wrap the inside of your home page’s “loop” inside something like this:

    if (!in_category(2)) { ... } (where category of id 2 is the youth category)

    The “loop” begins with this line <?php if (have_posts()) : while (have_posts()) : the_post(); ?>

    I explained a more rigorous way to do this here.

    Hi! thanks for the help! works like a treat! Sorry i didnt notice the article you pointed out in your post, that was really helpful too! thank you veyr much! 🙂

    -Crawf

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Restrict posts to only selected category (not shown on index page)’ is closed to new replies.