I have a Custom Post Type called "Movies" with 2 categories called "Now Showing" (cat id=6), and "Coming Soon" (cat id=7)

I am trying to alter the code to only pull in the child category for two separate pages, instead of ALL of the posts within the custom post type.

Here is the code I am trying to change: (Any help would be great!)

            <h3 class="section-title">Now Showing</h3>

            $args = array( 'post_type' => 'movies', 'paged'=>$paged );
            $loop = new WP_Query( $args );
            $i = 1;

            while ( $loop->have_posts() ) : $loop->the_post(); ?>

                <?php include( TEMPLATEPATH . '/includes/show-movies.php' ); ?>

            <?php endwhile; ?>
  • if i understand rightly that you want to show the articles of the category 'Now Showing' only - have you tried: $args = array( 'post_type' => 'movies', 'paged'=>$paged, 'category__in' => array(6) ); codex.wordpress.org/Function_Reference/… – Michael May 17 '11 at 16:41
  • Hello Michael, What you sent above did not quite do the trick. No posts are showing up at all. You are correct in what it is I am trying to accomplish though. "I want to ONLY show the category "Now Showing" Please see this page for a better idea...moxidesign.com/dev_chad/now-showing – Monique Anderson May 17 '11 at 17:18

For the Now showing add 'cat' => 6 to the query array like so:

    $args = array( 'post_type' => 'movies', 'paged'=>$paged ,'cat' => 6);

and for the Coming Soon add 'cat' => 7 so:

    $args = array( 'post_type' => 'movies', 'paged'=>$paged ,'cat' => 7);

but from what i can see you got it working:



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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