Double loop, category loop and posts per page
-
Hello everyone,
I’m a bit confused here…I’m trying to loop in my custom post type category, all of my categories, and show 2-3 posts per category…
Do I need a while… or a forearch… or both…
Here’s what i have so far.$args = array( 'post_type' => 'portfolio', 'category__not_in' => array( 30, 28 ), // Exclude IDS 'posts_per_page' => 2, // Number of posts per page I want to show 'order' => 'DESC', // Order ); // The new loop! $loop = new WP_Query( $args ); //Display the contents if (have_posts()) : while ( $loop->have_posts() ) : $loop->the_post(); ?> the_title(); ?> the_post_thumbnail('medium'); endwhile; endif;
My file’s name is : category-portfolio.php
Can you help me on this
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Double loop, category loop and posts per page’ is closed to new replies.