mizner
4/18/2016 - 5:19 AM

WP Query posts per page by category

WP Query posts per page by category

<?php 
$the_query = new WP_Query(array(
    'category_name' => 'featured',
    'posts_per_page' => '3'
));
while ($the_query->have_posts()) : $the_query->the_post(); ?>
    <div class="post-container">
        <?php the_post_thumbnail( 'medium' ) ?>
        <h3><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h3>
        <p><?php the_excerpt(); ?></p>
    </div>
<?php
endwhile;
wp_reset_postdata();
?>