Filtering categories within a loop/query_posts (3 posts)

  1. coyacreative
    Posted 3 years ago #

    <?php query_posts('category_name=people&posts_per_page=50'); ?>
    <?php $acs->query_posts(array('group_name' => 'People')); ?>
    <?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
    <li><a class="popup" href="<?php the_permalink(); ?>"><img src="<?php echo get_post_meta($post->ID, 'homepage_thumbnail', true); ?>" /></a></li>
    <?php endwhile; ?>

    Is there a way for me to call the category 'people' but have it exclude all posts that are in another category as well?

    Post 1 - People
    Post 2 - People
    Post 3 - People, Other
    Post 4 - People

    I am looking to query all people, but ignore posts that are in the 'other' category.

    Thanks for any help in advance.

  2. esmi
    Forum Moderator
    Posted 3 years ago #

    $args = array(
    'category_name' =? 'people',
    'posts_per_page' => 50,
    'category__not_in' => array( x )

    where x is the id of your Other category.

  3. coyacreative
    Posted 3 years ago #

    <?php $acs->query_posts(array('group_name' => 'People')); ?>

    Thanks, esmi. But I just realized the plugin Advance Custom Sort for posts is causing this to not work.

    I am using the sort list for grid view - but am needing the same 'group' on the homepage, but to manually remove a few posts.

    I have contacted the plugin developer - I hope it's possible.

Topic Closed

This topic has been closed to new replies.

About this Topic