How to Show Author name And Date on WordPress Theme

I have two simple code for Showing Author name And Date on WordPress theme. You can use give code o your WordPress custom theme.

Code for Author name

show only author name

<?php echo get_the_author(); ?>

with clickable

<a href="<?php echo esc_url(get_author_posts_url(get_the_author_meta('ID'))); ?>"><?php echo get_the_author(); ?></a>

Code for DATE

Show post published date

 <time class="updated" datetime="<?php echo esc_html(date(DATE_W3C, get_the_time('U'))) ?>" ><?php the_time(get_option('date_format')) ?></time>

Show post updated date

<time class="updated" datetime="<?php echo esc_html(date(DATE_W3C, get_the_modified_time('U'))) ?>">
<?php the_modified_time(get_option('date_format')) ?>
</time>

How to use

  1. Open active theme’s folder.
  2. Now paste given code where you want to show and SAVE.

Hope this code and article helpful for you. Thanks for visiting