I'm novice on wordpress development and I have this problem.
How can I show the post category name?
Example:
Post Title: Wordpress Rules! Post author: Irwin R. Post Date: 22/09/2014 Cat Name: Wordpress
I'm using the following code:
<?php
query_posts(array('cat' => 5, 'posts_per_page'=> 3, 'orderby' => 'ASC'));
while (have_posts()) { the_post();
?>
<h3>Post Title: <?php the_title();?></h3>
<h3>Post Author: <?php the_author();?></h3>
<h3>Post Date: <?php the_date();?></h3>
<h3>Cat Name: // What function should I use here?</h3>
<?php
}
wp_reset_query();
?>
I'll appreciate your help!
<?php the_category(', '); ?>
and as suggested below, never usequery_posts
. UseWP_Query
instead.