WordPress blog posts have meta information or post byline which is called as post meta data.

You can find these post bylines around the title, either above or below.

post byline or post meta data with link

What is Post Meta Data

The post meta information consists of post author name, post category and post published date and comments count for each post.

This meta information can be linked with archive pages (Author archives, Month archives, Category archive ).

Showing post meta data in your post is a good practice that helps people get these information and better navigation to post archives.

How To Show Post Byline With Link

By Post Author Name:

<?php the_author_posts_link(); ?>

the_author_post_link() outputs author name with an anchor to author archive page. All the posts by this author is listed on the author archive page.

<a href="http://smallenvelop.com/author/poonam/" title="Posts by poonam" rel="author">poonam</a>

By Post Publish Date:

<?php 
 $archive_year  = get_the_time('Y'); 
 $archive_month = get_the_time('m'); 
 $archive_day   = get_the_time('d'); 
?>
<a href="<?php echo get_day_link( $archive_year, $archive_month, $archive_day); ?>"><?php echo get_the_time('M d, Y') ?></a>

In the above code echo get_day_link ( $archive_year, $archive_month, $archive_day ); would output a URL which links to month archive. And the code echo get_the_time(‘M d, Y’) outputs the date. The string ‘M d  Y’ creates a date that look like this: May 18 2015.

You can use the following Formatting Date and Time in WordPress.

Here is what each format character in the string above represents:

  • l = Full name for day of the week (lower-case L).
  • F = Full name for the month.
  • j = The day of the month.
  • Y = The year in 4 digits. (lower-case y gives the year’s last 2 digits)
Day of Month
d Numeric, with leading zeros 01–31
j Numeric, without leading zeros 1–31
S The English suffix for the day of the month st, nd or th in the 1st, 2nd or 15th.
Weekday
l Full name  (lowercase ‘L’) Sunday – Saturday
D Three letter name Mon – Sun
Month
m Numeric, with leading zeros 01–12
n Numeric, without leading zeros 1–12
F Textual full January – December
M Textual three letters Jan – Dec
Year
Y Numeric, 4 digits Eg., 1999, 2003
y Numeric, 2 digits Eg., 99, 03
Time
a Lowercase am, pm
A Uppercase AM, PM
g Hour, 12-hour, without leading zeros 1–12
h Hour, 12-hour, with leading zeros 01–12
G Hour, 24-hour, without leading zeros 0-23
H Hour, 24-hour, with leading zeros 00-23
i Minutes, with leading zeros 00-59
s Seconds, with leading zeros 00-59
T Timezone abbreviation Eg., EST, MDT …
Full Date/Time
c ISO 8601 2004-02-12T15:19:21+00:00
r RFC 2822 Thu, 21 Dec 2000 16:01:07 +0200

Post category:

<?php echo get_the_category_list(', '); ?>

get_the_category_list(‘, ‘) shows all the categories the post is assigned to, in unordered list with comma separated links to archive. For example:

<ul class="post-categories">
 <li><a href="http://smallenvelop.com/category/wordpress-basics/" rel="category tag">How to</a>, </li>
 <li><a href="http://smallenvelop.com/category/theme-customization/" rel="category tag">Theme Customization</a></li>
</ul>

By Post Comment Count:

<?php comments_number( 'no responses', 'one response', '% responses' ); ?>

In the above code, % shows number of comments in the posts, if it’s not 0 or 1. If there is no comments it will simply echo ‘no responses’, if there is only one comment it will echo one response.

You can replace the word ‘ No responses’, ‘one response’ and ‘responses’ in the third argument and leave the ‘%’ as it is.

By Post modified date:

Sometimes we need to show when the post was updated and modified so that the visitors may be aware of the new contents added to that post.

Last modified <?php the_modified_time('F j, Y'); ?> // <?php the_modified_time('g:i a'); ?>

It will output the following: Last modified May 17, 2015 // 10:56 am

Hope this article may be helpful to you. Leave comments.