• Hi,

    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:

    <?php
    $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.
    Jason

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Display posts from a specific range of categories’ is closed to new replies.