я хочу показать список авторов таксономии и упорядочить список по количеству сообщений. В конце я хочу показать изображения авторов разного размера в зависимости от количества их сообщений.
Вот что у меня есть (источник: http://blog.brianjohnsondesign.com/dropdown-list-of-authors-with-posts-in-category/):
<ul>
<?php //Code to get a list of all authors with posts in this category, and then create a dropdown list of their names with links to their page
$category = get_queried_object();
$taxonomy_name = 'themen'; //Change to reflect the name of your custom taxonomy
$current_category = $category->slug;
$author_array = array();
$args = array(
'posts_per_page' => -1,
'post_type' => 'post', //Change to your custom post type
'tax_query' => array(
array(
'taxonomy' => 'themen', //Change to reflect the name of your custom taxonomy
'field' => 'slug',
'terms' => $current_category
),
),
'orderby' => 'author',
'order' => 'ASC'
);
$cat_posts = get_posts($args);
foreach ($cat_posts as $cat_post) :
if (!in_array($cat_post->post_author,$author_array)) {
$author_array[] = $cat_post->post_author;
}
endforeach;
foreach ($author_array as $author) :
$auth = get_userdata($author)->display_name;
$nicename = get_userdata($author)->user_nicename;
//echo '<li><a href="' . get_term_link( $category->slug, $taxonomy_name ) . '/' . $nicename . '">' . $auth . '</a></li>';
echo '<li><a href="/author/' . $nicename . '/">' . $auth . '</a></li>';
endforeach;
?>
</ul>
Это правильное направление? Я не уверен, как я могу заказать авторов. :(