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; ?>
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s