How to display latest post from specific category in wordpress

Topics focus on Web Developments, Programming, Database, Digital Marketing Tutorials, Code Snippets, SEO, Social Media Marketing and Inspirational articles.

How to display latest post from specific category in wordpress

How to display latest post from specific category in wordpress

How to display latest post from specific category in wordpress

Hi friends, this is very important for all magazine or news website company who are mostly want to display latest post from specific category in wordpress for particular area of category.

Below is the code which you can put in template file. But make sure you will change the category id and number of posts to display.

1
2
3
4
5
6
7
8
9
10
11
<?php
	query_posts('showposts=1&cat=1');
	while(have_posts()) : the_post();
?>
	<div>
		<span class="post-title"><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></span>
		<p class="post-content"><?php the_content(); ?></p>
	</div>
<?php 
	endwhile; 
?>

Add comment


 

Pin It on Pinterest

Share This