Use get_categories–in this case for category 3
<?php
$args=array(
'include' => 3,
'orderby' => 'name',
'order' => 'ASC'
);
$categories=get_categories($args);
foreach($categories as $category) {
echo '<p>Category: <a href="' . get_category_link( $category->term_id ) . '" title="' . sprintf( __( "View all posts in %s" ), $category->name ) . '" ' . '>' . $category->name . ' with ' . $category->count . ' posts </a> </p> ';
}
?>
See Function_Reference/get_categories for more arguments
can i use the category name instead of the id
$catid = get_cat_ID('your category name here');
$args=array(
'include' => $catid,
'orderby' => 'name',
'order' => 'ASC'
);
Michael
Thanks for all your help. I have one more question when the category count is 0 there is nothing printed. Is there any way i can print out the categories with 0 posts also
That link above would have told you about hide_empty
$args=array(
'hide_empty' => 0,
'include' => $catid,
'orderby' => 'name',
'order' => 'ASC'
);