Domanda

I am using wp_list_authors, to, how function name says, make a list of authors, but i want to show only "Authors". Now in my site, any account who publish a text ("Admin", "Editor") show his name in my list of authors, but i want ONLY users who are Authors. How can i make this happen?

My code now

<?php $args = array(
  'orderby'       => 'name',
  'order'         => 'ASC',
  'number'        => 6,
  'optioncount'   => true,
  'exclude_admin' => true,
  'show_fullname' => false,
  'hide_empty'    => true,
  'echo'          => true,
  'style'         => 'list',
  'html'          => true); ?>
È stato utile?

Soluzione

wp_list_authors(), displays a list of the sites's authors (users), and if the user has authored any posts, the author name is displayed as a link to their posts.

Use

 $authors = get_users( [ 'role__in' => [ 'auther'] ],
                // add other parameters
                );

Then loop through $authors to create your own list.

foreach ( $authors as $author ) {
    // your list goes here
}

I hope this helps to start.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a wordpress.stackexchange
scroll top