Ready to get started?Download WordPress


[resolved] Exclude cat. from home page? (6 posts)

  1. Stowaway
    Posted 6 years ago #

    Hi people,

    My first post, loving wordpress, been reading, learning and slowly inputting bits for the last couple of days!

    I need a spot of help, my website is http://www.gamebargain.co.uk

    If you go there, it takes you to the main page, which shows all blog posts from all my catagories.

    I would really like to exclude it from showing the posts from my submit a bargain catagory, as this is the user generated content side of things and they wont adhere to the same templating I am using for my own postings. I want my home page to look nice, so want to restrict the user generated posts to the submit-a-bargain catagory, then if I want to 'mainpage' the bargain I will edit it myself.

    Any help would be much appreciated.

  2. MichaelH
    Posted 6 years ago #

  3. Stowaway
    Posted 6 years ago #

    Thank ya sir, I will try this now and report back

  4. Stowaway
    Posted 6 years ago #

    The exclusion code works brilliantly, I have a follow up to it quickly.

    How can I expand the number?

    So I have

    query_posts($query_string . '&cat=-4');

    Removing one category, for example, how would I also exclude cat 7 and 8?

  5. MichaelH
    Posted 6 years ago #

    The template tag, query_posts(), also offers the category__not_in=.

    Don't know how to tell you to merge $query_string with the array of those categories so try:

    query_posts(array('category__not_in' => array(7,8)));

  6. Stowaway
    Posted 6 years ago #

    thanks, that has worked

Topic Closed

This topic has been closed to new replies.

About this Topic