Author Page Code list for WordPress Theme Development

Shortlink:

If you click on the author link on a WordPress website and it only shows excerpts of their previous posts, the theme probably does not have an author.php template. Excerpts are shown because of the template hierarchy for authors:

author-{nicename}.php
author-{id}.php
author.php
archive.php
index.php

// Show Author All Post link

<?php the_author_posts_link(); ?>

// Show All Author list in WordPress site.

<?php wp_list_authors(); ?> 

By default the tag excludes the admin account from the list and users who haven’t any posts. Here are some examples of how wp_list_authors() can be used:

<?php wp_list_authors('hide_empty=0'); ?>

Display all users including those with no posts.

<?php wp_list_authors('show_fullname=1&optioncount=1'); ?>

Display the post count and full name of each user.

<?php wp_list_authors('orderby=post_count&order=DESC&number=10'); ?> 

The bio area is very easy to modify. All of the information the author entered into their profile can be called using the get_the_author_meta function. You can pass two parameters into this function: $field and $userID

<code class="php plain"><?php get_the_author_meta( </code><code class="php variable">$field</code><code class="php plain">, </code><code class="php variable">$userID</code><code class="php plain">); ?> </code> 

Displays the authors login name.

 <?php the_author_meta( 'user_login' ); ?> 

Displays the authors password in hexadecimal form

<?php the_author_meta( 'user_pass' ); ?> 

Displays the authors nicename (same as their login)

 <?php the_author_meta( 'user_nicename' ); ?> 

Displays the authors email address.

 <?php the_author_meta( 'user_email' ); ?> 

Displays the authors URL.

<?php the_author_meta( 'user_url' ); ?> 

Displays the date the author registered with your site.

<?php the_author_meta( 'user_registered' ); ?>

Displays the authors activation key (if applicable).

<?php the_author_meta( 'user_activation_key' ); ?> 

Displays the authors user status e.g. user who has confirmed account has a user status of 2.

<?php the_author_meta( 'user_status' ); ?> 

Displays the name the author has chosen to display publicly.

<?php the_author_meta( 'display_name' ); ?> 

Displays the authors nickname.

<?php the_author_meta( 'nickname' ); ?> 

Displays the authors first name.

<?php the_author_meta( 'first_name' ); ?> 

Displays the authors last name.

<?php the_author_meta( 'last_name' ); ?> 

Displays the authors bio.

<?php the_author_meta( 'description' ); ?> 

Displays the authors Jabber / Google Talk contact info.

  <?php the_author_meta( 'jabber' ); ?> 

Displays the authors AIM contact info.

 <?php the_author_meta( 'aim' ); ?> 

Displays the authors Yahoo messenger contact info.

 <?php the_author_meta( 'yim' ); ?> 

Displays the authors user level (e.g. admin are level 10, subscribers are level 0).

  <?php the_author_meta( 'user_level' ); ?> 

Displays the authors first name.

  <?php the_author_meta( 'user_firstname' ); ?> 

Displays the authors last name.

 <?php the_author_meta( 'user_lastname' ); ?> 

Displays the authors bio.

<?php the_author_meta( 'user_description' ); ?> 

they have disabled it.

 <?php the_author_meta( 'rich_editing' ); ?> 

Displays true if the author has keyboard shortcuts enabled and false if they are not.

 <?php the_author_meta( 'comment_shortcuts' ); ?> 

Displays the colour scheme the author has chosen for the admin area (classic for blue and fresh for grey).

 <?php the_author_meta( 'admin_color' ); ?> 

Displays the authors ID.

 <?php the_author_meta( 'ID' ); ?> 

Show Author image

<?php echo get_avatar(get_the_author_meta('email'), '100', '', '');    ?> 

Show Author All Post URL

<?php echo esc_url( get_author_posts_url( get_the_author_meta( "ID" ) )) ; ?> 

Show Current Author Registration date

 <?php $user_id = get_the_author_meta('ID'); echo date("F j, Y", strtotime(get_userdata($user_id)->user_registered)); ?> 

Show Current Author Registration Time:

 <?php $user_id = get_the_author_meta('ID'); echo date("g:i a", strtotime(get_userdata($user_id)->user_registered)); ?> 

if you want to change date or time format ? just see this tutorial date and time format

Show Post publish time

<?php echo get_the_time(); ?> 

show post publish date

<?php the_time('F j, Y'); ?> 

Show WordPress Post Last Modified date

<?php the_modified_time('F j, Y'); ?> 

Show WordPress Post Last Modified Time:

<?php the_modified_time('g:i a'); ?> 

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload CAPTCHA.

Subscribe For Latest Updates

Signup for our newsletter and get notified when we publish new articles for free!




%d bloggers like this: