How to get post by category in WordPress – PHPCluster
Hi guys,if we talk about WordPress or any other CMS(Content Management System) , then a question arises in front of us yhat how we can fetch post by category in wordpress or any CMS.

To display post by category is easy process to work out using WordPress function .Now, I am going to discuss with all of you about how easily you show your post by category with count limit ,post title,post description and its thumbnail.
<?php $my_query_post= new WP_Query('cat=1&post_count=5'); ?> <ul> <?php while ($my_query_post->have_posts()) : $my_query_post->the_post(); $do_not_duplicate = $post->ID;?> <li><a href="<?php the_permalink(); ?>"><?php the_title(); the_excerpt(); the_post_thumbnail(); ?></a> </li>
Also See: