Wednesday 14 August 2013

How to display specific category post in wordpress

$category = get_the_category();
if($category[0]){
echo '<a href="'.get_category_link($category[0]->term_id ).'">'.$category[0]->cat_name.'</a>';
}
query_posts('showposts=1&cat=3');
while(have_posts()) : the_post();

?>
<ul>
<li><h3><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h3>

<ul><li><?php the_content(); ?></li>
</ul>
</li>
</ul>
<?php endwhile;?>

No comments:

Post a Comment