• Hi everybody,
    I’ve got the following code

    <?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; query_posts('posts_per_page=4&paged=' . $paged); ?>
    <?php if (have_posts()) : while(have_posts()) : the_post(); ?>

    used to display latest posts from all categories on my blog.
    Does anyone know what I should do to exclude two or more categories (let’s say with ID 260 and ID 320) from showing their posts on the page?

Viewing 1 replies (of 1 total)
  • Hello

    The solution will be like this

    <?php query_posts( ‘cat=-1,-2,-3&posts_per_page=5’ ); ?>

    by using – you can negate the specific category.

    Hope it will help you.

    thank you

Viewing 1 replies (of 1 total)
  • The topic ‘Exclude posts from certain categories in latest posts’ is closed to new replies.