• I want to have a page that shows all of the blog’s authors and their profiles. How can I do this and limit it only to author’s who have at least one post published (since there are many contributors that have zero posts that I don’t want displayed)? Thank you.

Viewing 3 replies - 1 through 3 (of 3 total)
  • This is the WP doc for that

    But I used this to make mine

    I’m pretty sure the default behavior of an author page is to show only authors that have a post, so you’re fine there.

    Here’s a copy of my authors page template from https://www.sbgla.com, just for an example:

    <?
    /*
    Template Name: Authors
    */
    ?>
    <?php get_header(); ?>
    <div id="content">
    <h1 style="margin:0;">Contributors</h1>
    <p style="margin:0 0 20px; font-size:.9em; font-style:italic;">Click a contributor's name or image to browse all of their articles.</p>
    <?php
    
    // Get the authors from the database ordered by user nicename
    	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->user_login == 'admin') :
    
    		// Get link to author page
    			$user_link = get_author_posts_url($curauth->ID);
    
    		// Set default avatar (values = default, wavatar, identicon, monsterid)
    			$avatar = 'identicon';
    ?>
    
    <div class="main authorbox">
    <div class="authbox_left">
    <a href="<?php echo $user_link; ?>" title="Articles by <?php echo $curauth->display_name; ?>">
    <?php echo get_avatar($curauth->user_email, '96', $avatar); ?></a>
    </div>
    <div class="authbox_right">
    <h2>
    <a href="<?php echo $user_link; ?>" title="Articles by <?php echo $curauth->display_name; ?>"><?php echo $curauth->display_name; ?></a>
    </h2>
    <p style="margin-bottom:0;"><strong>Website:</strong> <a href="<?php echo $curauth->user_url; ?>"><?php echo $curauth->user_url; ?></a></p>
    <p style="margin-bottom:4px;"><strong>Twitter: </strong><a href="<?php echo $curauth->jabber; ?>"><?php echo $curauth->jabber; ?></a></p>
    <p style="margin-bottom:0;"><?php echo $curauth->description; ?></p>
    </div>
    <div style="clear:both;"></div>
    </div> <!-- end post -->
    <div style="clear:both;"></div>
    <?php endif; ?>
    <?php endforeach; ?>
    </div>
    <?php get_sidebar(); ?>
    <?php get_footer(); ?>
    Thread Starter sammy123

    (@sammy123)

    I’m pretty sure the default behavior of an author page is to show only authors that have a post, so you’re fine there.

    Thanks for the quick rely. It actually shows all the contributors (even those with zero posts). Anyway to limit this function to only those with at least one post?

    I don’t know how to do that, no, sorry.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Multiple Author Blog: How to Have a All Author’s Page?’ is closed to new replies.