Display posts from a specific range of categories (2 posts)

  1. Jason_K70
    Posted 3 years ago #


    I realise this has been addressed several times in the forums, but I've not been able to relate the solutions to the code that I'm using.

    I've had a site built for me, I have a "latest news" area, which currently shows all posts, regardless of category. I need to show only posts from a specific range of categories (or even just exclude one particular category from being displayed). The code is currently as follows:

    $args = array('post_type' => 'post', 'posts_per_page' => 3);
    $loop = new WP_Query($args);
    $count = 0;
    while ($loop->have_posts()) : $loop->the_post(); $count++;

    It then goes on to print the titles and excerpts, etc. for posts from all categories. So what I'd like to do is either display posts from just categories 1, 2 and 4, or exclude posts from category 3.

    Any help would be hugely appreciated.

  2. esmi
    Forum Moderator
    Posted 3 years ago #

Topic Closed

This topic has been closed to new replies.

About this Topic