<?php
$cat2=12; // The 12 is a category id
$yourcat2 = get_category($cat2);
?>
<div>
<div>
<div><?php echo $yourcat2->name; ?></div> // Get ategory name
<div>
<h3><?php echo $yourcat2->slug; ?></h3> // Get category slug
<ul>
<?php
query_posts(‘showposts=4&cat=12‘); // The 4 is a display post count and 12 is a category id
while(have_posts()) : the_post();
?>
<li><a href=”<?php the_permalink() ?>” rel=”bookmark”><?php the_title(); ?></a></li> // Get post title with url
<?php endwhile;?>
</ul>
</div>
</div>
</div>
How to get particular category and post
26 Tuesday Nov 2013
Posted WordPress
in