Created
April 18, 2016 05:19
-
-
Save mizner/76953fb9b83b35b96227716e12af8328 to your computer and use it in GitHub Desktop.
WP Query posts per page by category
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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(); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment