How To Get Category Name ,Author Name And Date In WordPress

Get Category :

You can get category name by perticular post

<?php $categories = get_the_category(); $separator = ' ';
$output = '';
if($categories){
foreach($categories as $category) {
$output .= '<a href="'.get_category_link( $category->term_id ).''
. esc_attr( sprintf( __( "" ), $category->name ) ) . '">
'.$category->cat_name.'</a>'.$separator;
} echo trim($output, $separator); } ?>

Get Auther Name :

You can get author name by perticular post

<?php the_author_posts_link(); ?>

Get Posted Date :

<?php echo the_time(get_option('date_format'));?>
Also you can get Number of comments
<?php $commentscount = get_comments_number(); echo $commentscount; ?>

Leave a comment