Displaying all your writers profile in one page is a one way to make your blog look more professional. But there is limited number of tweaks or plugins available over the WordPress repository to make your work easy. Even I was trying to do this tweak since very long and tried several plugins which wasn’t successful and the results were not up to what I was expected.
I usually gather WordPress tutorials over the internet to make my own edits on my blogs; one of latest example is displaying Adsense ads on WordPress jetpack mobile theme. The other day I was reading an article on a blog about displaying multiple authors in one page using a plug-in called WP Biographia, looks like a cool plug-in made with lot of hard works. I really hesitated to try that plug-in because I was worried about adding another plug-in to my WordPress blog.
So, all these situations again led me to do some task over the last weekend and made something look like a cool multiple author’s page. here is the tutorial how I made it, keep reading and you are free to use it for your own work.
Note: The tweak displayed here is made for the theme I’m using, the CSS properties and HTML tags are just for your reference only, you have to change it according to your own.
Step 1: Prepare a blank Page Template
First, create a blank template and name it as “All Authors” or whatever comfortable for you.If you aren’t sure how to create a blank php page template look at this tutorial.
In my case I created a blank page template called “All Authors” like below:
php /* Template Name: All Authors */ ?>
Secondly, add all required parts like;
php get_header(); ?>
php get_sidebar(); ?>
php get_footer(); ?>
Now that, the blank page is prepared which will display your header, sidebar and footer without any content in it. Now, we are going to add content (all authors bio) in next step.
Step 2: Create A content tag
Now add below html tag where your content displays:
<div id="content" class="your own class">
Step 3: Pull all authors from your blog
In this step, we are going to add php code which will pull all authors from your blog and display them in alphabetical order. Here is the script for you;
Add post content php code:
php ?> <h1 class="page-title"> php the_post(); ?> php $content = get_the_content(); ?> php if ( ! empty( $content ) ) : ?> <div class="post"> <div class="entry"> php the_content(); ?> </div> </div> php endif; ?>
In this step we are going to get the all your authors from your blog’s database ordered by user nicename (in an alphabetical order).
php // This query pulls authors name alphabetically from your mySQL database global $wpdb; $query = "SELECT ID, user_nicename from $wpdb->users ORDER BY user_nicename"; $author_ids = $wpdb->get_results($query); // Loop through each author foreach($author_ids as $author) : // Get user data $curauth = get_userdata($author->ID); // If user level is above 0 or login name is "admin", display profile if ($curauth->user_level > 0 && $curauth->description || $curauth->user_login == 'admin' && $curauth->description) : // Get link to author page $user_link = get_author_posts_url($curauth->ID); // Set default avatar (values = default, wavatar, identicon, monsterid) $avatar = 'wavatar'; ?> <div class="auth-bio clearfix"> <div class="entry clearfix"> php /* Get author name */ ?> <h3 style="margin-bottom:10px;">display_name; ?> php /* Get author gravatar */ ?> php echo $user_link; ?>" title="display_name; ?>">user_email, '100', $avatar); ?> php /* Get author bio info */ ?>
php echo $curauth->description; ?>
php /* Get author link to recent posts */ ?> php echo $user_link; ?>" title="display_name; ?>"> </p> php // Get author's latest post title query_posts("author=$author->ID&showposts=1"); if (have_posts()) : while(have_posts()) : the_post(); ?> php endwhile; endif; ?> </div> php /* Get author's social media icons */ ?> </div> php endif; ?> php endforeach; ?> php /* END THE ALL AUTHORS PAGE TEMPLATE CONTENT */ ?>
In above code declared classes are my css properties, you may have to change them.
That’s it, now you have created a multi author page which displays all your authors with their bio, Gravatar and website. I have added nofollow to website, you can remove it if you want them to make do-follow.
below is the download link to ready made template I have created you can download and use it, you need to like our blog first to do so..
Powered by Like to Download