• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer
WordPress a2z

WordPress a2z

WordPress Dynamic API Reference

  • Home
  • Plugins
  • Themes
  • Shortcodes
  • APIs
  • Classes
  • Files
  • Hooks
  • Sitemap
  • Blog
Home / APIs / twentyfourteen_list_authors() – Print a list of all site contributors who published at least one post.

You appear to be a bot. Output may be restricted

Description

Print a list of all site contributors who published at least one post.

Usage

twentyfourteen_list_authors();

Parameters

Returns

void

Source

File name: twentyfourteen/functions.php
Lines:

1 to 40 of 40
  function twentyfourteen_list_authors() {
    $contributor_ids = get_users(
      array(
        'fields'  => 'ID',
        'orderby' => 'post_count',
        'order'   => 'DESC',
        'who'     => 'authors',
      )
    );

    foreach ( $contributor_ids as $contributor_id ) :
      $post_count = count_user_posts( $contributor_id );

      // Move on if user has not published a post (yet).
      if ( ! $post_count ) {
        continue;
      }
      ?>

		<div class="contributor">
		<div class="contributor-info">
			<div class="contributor-avatar"><?php echo get_avatar( $contributor_id, 132 ); ?></div>
			<div class="contributor-summary">
				<h2 class="contributor-name"><?php echo get_the_author_meta( 'display_name', $contributor_id ); ?></h2>
				<p class="contributor-bio">
					<?php echo get_the_author_meta( 'description', $contributor_id ); ?>
				</p>
				<a class="button contributor-posts-link" href="<?php echo esc_url( get_author_posts_url( $contributor_id ) ); ?>">
					<?php
          /* translators: %d: Post count. */
          printf( _n( '%d Article', '%d Articles', $post_count, 'twentyfourteen' ), $post_count );
          ?>
				</a>
			</div><!-- .contributor-summary -->
		</div><!-- .contributor-info -->
	</div><!-- .contributor -->

			<?php
  endforeach;
  }
 

 View on Trac

Published: 19th December 2019 | Last updated: 8th April 2020

Primary Sidebar

Information

Function name: twentyfourteen_list_authors
Plugin ref: Twenty Fourteen
Version: 3.0
Sourcefile: functions.php
File ref: functions.php
Deprecated?: No
API Letters: A,L,T

Footer

WordPress a2z
WordPress a2z
WordPress Dynamic API Reference
WordPress 5.6. PHP: 7.3.26
WordPress a2z
WordPress core a2z
Genesis Theme Framework a2z
Jetpack a2z
WordPress develop tests
Easy Digital Downloads a2z
WooCommerce a2z
Yoast SEO a2z
WordPress Blocks

Site:  wp-a2z.org
© Copyright WordPress a2z 2014-2021. All rights reserved.


Website designed and developed by Herb Miller
Proudly powered by WordPress and oik plugins

  • Home
  • Blog
  • Sitemap
  • Sites