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

  1. crawf
    Posted 10 years ago #

    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!


  2. Austin Matzko
    Posted 10 years ago #

    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.

  3. crawf
    Posted 10 years ago #

    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! :)


Topic Closed

This topic has been closed to new replies.

About this Topic


No tags yet.