WordPress.org

Ready to get started?Download WordPress

Forums

Query help, combing... showing & excluding. (2 posts)

  1. jezThomp
    Member
    Posted 3 years ago #

    I have the following code...

    Showing posts from category 10 and excluding post with the id 247,247

    <?php query_posts('cat=10'); ?>
    
    <?php query_posts( array( 'post__not_in' => array(247,245) ) ); ?>

    However the second one is overriding the first one and just showing all the posts in the whole site!

    Anyway i can combine this query to show only posts from Cat ID 10 and exclude the posts 247,246?

    Many thanks :)

  2. keesiemeijer
    moderator
    Posted 3 years ago #

    try this:
    <?php query_posts( array( 'post__not_in' => array(247,245), cat => 10 ) ); ?>

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.