co-authors plugin – inline listing

solved using for loop instead of foreach: function inl_users() { if ( function_exists( ‘get_coauthors’ ) ) { $coauthors = get_coauthors(); for ($i = 0; $i < count($coauthors); $i++){ $autArray[] = ‘<a href=”https://wordpress.stackexchange.com/questions/404167/. get_author_posts_url( $coauthors[$i]->ID ) .”>’ . $coauthors[$i]->display_name . ‘</a>’; } echo implode(“, “, $autArray); } does anoyone know why?

Latest 5 post excerpts from 5 different authors in Sidebar

Think I’ve figured it out. Here’s the code I used courtesy of this thread on the WP Support Forum. Just replace ()<?php the_author_posts_link(); ?>() with whatever excerpt code you want to use. And Voila! <?php //list 5 latest authors $authors = array(); $count = 0; $args=array( ‘post_type’ => ‘post’, ‘post_status’ => ‘publish’, ‘posts_per_page’ => -1, … Read more

How to show list authors with at least five posts published

Hacky way of doing it: global $wpdb; $min_posts = 5; // Make sure it’s int, it’s not escaped in the query $author_ids = $wpdb->get_col(“SELECT `post_author` FROM (SELECT `post_author`, COUNT(*) AS `count` FROM {$wpdb->posts} WHERE `post_status`=’publish’ GROUP BY `post_author`) AS `stats` WHERE `count` >= {$min_posts} ORDER BY `count` DESC;”); // Do what you want to $author_ids … Read more

Only show authors with posts

$args = array( ‘posts_per_page’ => 1, ‘author’ => $author->ID ); $posts = new WP_Query( $args ); $count = count( $posts ); Put this right after the foreach, $count will now contain either 1 or 0, put it through an if statement to filter the output.

Add formatting to Array

I’m finding it a little hard to follow based on your comments, however if you want to add a <div> around each other then change your second foreach statement to; foreach ($uc as $key => $value) { $user = get_userdata($key); $post_count = get_usernumposts($user->ID); if ($post_count) { $author_posts_url = get_author_posts_url($key); echo ‘<div class=”class-name-here”>’; echo ‘<li><a href=”‘ … Read more

Display all authors in a theme template

What you need here is to shuffle all the array elements & then display them. But since php’s shuffle() function doesn’t preserve array key associations, here’s a version that does. function shuffle_assoc(&$array) { $keys = array_keys($array); shuffle($keys); foreach($keys as $key) { $new[(string)$key] = $array[$key]; } $array = $new; return true; } Add this function somewhere … Read more

How can i list random author?

The Codex lists rand as the orderby string, not RAND. I suspect that either works but I haven’t checked. But that isn’t how I’d do this. I’d lean toward something like… $current_category_ID = getCurrentCatID(); $current_cat_id = $current_category_ID; $author_array = array(); $args = array( ‘numberposts’ => -1, ‘cat’ => $current_cat_id ); $cat_posts = get_posts($args); foreach ($cat_posts … Read more

Listing wordpress users with a search function

This worked for me. $user_query = new WP_User_Query( array( ‘search’ => ‘*example.net*’, ‘search_columns’ => array(‘user_url’) )); $authors = $user_query->get_results(); The wild card to be used in the search string is ‘*’ and not ‘%’. Also you have to include the ‘search_columns’ parameter with the following possible values search_columns = array( ‘user_nicename’, ‘user_login’, ‘user_email’, ‘user_url’ ) … Read more

Comment_author_url doing nothing

Change your query from: SELECT COUNT(comment_author_email) AS comments_count, comment_author_email, comment_author, comment_author_url FROM ‘.$wpdb->comments.’ WHERE comment_author_email != “” AND comment_type = “” AND comment_approved = 1 GROUP BY comment_author_email ORDER BY comments_count DESC, comment_author ASC LIMIT ‘.$amount To: SELECT *, COUNT(comment_author_email) AS comments_count, comment_author_email, comment_author, comment_author_url FROM ‘.$wpdb->comments.’ WHERE comment_author_email != “” AND comment_type = “” … Read more