I have a portfolio website where my portfolio updates are supposed to go to both my portfolio and blog pages, as well as show thumbnails for the posts on my homepage.

The thumbnails work perfectly; if a post is to go in two categories, the thumbnails show up in both categories.

My trouble is with the blog- posts marked to go in both blog and portfolio categories only show up in my portfolio. Here's what I'm using for the blog:

<div id="blog">
    <?php query_posts('cat=-4'); ?>
    <?php if(have_posts()) : while(have_posts()) : the_post('cat=-3,4'); ?>
    <div class="post-title">
        <h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
    </div><!-- end post-title -->
    <div class="post">
        <?php the_content('read more...'); ?>
    </div><!-- end post -->
    <div class="post-meta">
        <p><?php the_date(); ?> | <?php the_tags('tags:', ', ', '<br />'); ?></p>
    </div><!-- end post-meta -->
    <?php endwhile; ?>
    <?php else : ?>
            <p>I'm not sure what you're looking for.</p>
    <?php endif; ?>
</div><!-- end blog -->

Any ideas what could be causing this or how to remedy?

1 Answer 1


First thing : you should not use category ids directly. Use slugs instead : it's easier to maintain.

<?php query_posts('category_name=portfolio'); ?>

Second thing : why did you put a query parameter in the_post ? This function does not accept any parameter (see the Codex).

Third thing : the call to query_posts('cat=-4'); will show all posts EXCEPT the one that have the category N°4 (portfolio, if I guess well). This is not want you want, right ?

Want you want is query_posts('category_name=portfolio'); in your portfolio page and query_posts('category_name=blog'); in your blog page.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.