How to get authors who have added the post in the specific custom post type

I have a custom post called event and I have to show all the authors who have added the post. I have tried the below code but I am getting all the users on the page. For example. There are 4 users called A, B, C, and D on the website and A and B added the post. Now I have to get only A and B users but below code getting all the users like A,B,C,D Any idea how …
Category: Web

Adding custom column in User List with custom action

I want to add a custom column in the User list in the WordPress admin dashboard with a custom action to perform. It means in the custom column, I want to add a button for each user. While clicking the button, it will redirect to a new page link with user_id. How can I achieve this?
Category: Web

co-authors plugin - inline listing

I'm trying to set up co-authors plugin in order to show articles authors function inl_users() { if ( function_exists( 'get_coauthors' ) ) { $coauthors = get_coauthors(); //array_shift($coauthors); foreach ( $coauthors as $coauthor ) { $autArray[] = '<a href=' . get_author_posts_url( $coauthor->ID ) . '>' . $coauthor->display_name . '</a>'; echo implode(", ", $autArray); } } The first author is shown twice in the first element, like this: for $autArray = (John Smith, Joe Blogs); it returns John SmithJohn Smith, Joe Blogs …
Category: Web

Get List of all the Authors

How could i get List of all the Authors? author.php file shows the Information about Individual Author. for example: http://domain.com/author/bj that returns the Bj's Profile. if i enter http://domain.com/author it returns 404 Not Found Author page shows author's avatar, Author's Name and description. how can i list out all the authors? Need Help!
Category: Web

Combining wp_list_authors with get_user_meta

i am using the wp_list_authors function as the following: <?php wp_list_authors( array( 'show_fullname' => 'true', 'orderby' => 'display_name', 'order' => 'ASC' )) ?> However this shows the authors by firstname + lastname I want to switch that so it shows the users lastname + firstname. I cant figure out how can i use the get_user_meta in the function. It is possible or should I use something else than wp_list_authors?
Category: Web

List total number of users that are authors

Question I want to display total number of Authors and total number of subscribers on the blog but exclude the admin in this way: 56 Authors so far 15 Subscribers so far Code that is close to what I need :) I have this code and it displays the total number of everybody that is registered. I need it to display authors and subscriber roles separately. Please help :) <?php $users = $wpdb->get_var("SELECT COUNT(ID) FROM $wpdb->users"); echo $users." members so …
Category: Web

Count author posts in certain category

I am using this code to only get authors who have posted in the 'Travel' category but the part 'category_name' => 'travel' doesn't seem to work. The code currently gets all posts in all categories. <?php $args = array( 'exclude' => array( 10, 18 ), 'role' => 'contributor', 'category_name' => 'travel', ); $wp_user_query = new WP_User_Query($args); $authors = $wp_user_query->get_results(); if (!empty($authors)) { foreach ($authors as $author) { if ( count_user_posts($author->ID) >= 1 ) { } } }
Category: Web

List of all authors avatars

I'm looking for a way to retrieve all authors with their avatar. I know there is a way to get an authors avatar but I want to get all avatars of all the authors :) echo get_avatar(get_the_author_meta('ID'), '160'); I tried to combine this command with wp_list_authors() but didn't find a way. How can I retrieve a list of all authors with their avatars? Thank you!
Category: Web

Probleme shortcode with list author

I have created a list of my contributors for my website it works well. I'm trying to do this with a shortcode in my functions.php. The list appears well. But when I want to place it in my theme in any page, it appears before the content whereas I want it to be at the bottom of the page of its appropriate page template. I can't seem to find my mistake function comite_shortcode( $atts ){ $contributor_member = array( 'role' => …
Category: Web

List Authors For Current Category

I want to list all unique authors that have posts in the current category. My code (location: wp-content/themes/custom-theme/category.php) <div class="container"> <div class="row"> <?php if ( have_posts() ) : ?> <?php while( have_posts() ) : the_author(); ?> <div class="col-md-2 text-center"> <?php the_author_meta( 'display_name', 30 ); ?> </div> <?php endwhile; ?> <?php else: ?> <p class="text-center">No authors</p> <?php endif; ?> </div> </div> This is not giving expected result, can someone help me?
Category: Web

Uncode theme, create author page and author link under the blog

On my company's website, there is a blog page which displays blogs of all team members. I want to create an author link below each blog which takes to the author individual page and this page displays their profile pic, bio and blogs they have written till date. I am using Uncode theme. There is author module in it. I tried using it but it doesn't show different authors. It shows only current logged in user as author. This is …
Category: Web

Author social media aren't shown on the page

I'm trying to show the authors social medias on the page but they aren't showed at all. Here is the code that I have so far $website = $user->user_url; if($user->user_url != '') { printf('<a href="%s">%s</a>', $user->user_url, '<i class="icon-home"></i>'); } $twitter = get_user_meta($user->ID, 'twitter_profile', true); if($twitter != '') { printf('<a href="%s">%s</a>', $twitter, '<i class="icon-twitter"></i>'); } $facebook = get_user_meta($user->ID, 'facebook_profile', true); if($facebook != '') { printf('<a href="%s">%s</a>', $facebook, '<i class="icon-facebook"></i>'); } $google = get_user_meta($user->ID, 'google_profile', true); if($google != ''){ printf('<a href="%s">%s</a>', $google, …
Category: Web

How can I show the author's latest post with title?

The following is my code: (klcom is my theme name) I just show the author by: name and description, I want to show the author's last 3 post with tile after each author, How can I code? Thanks <ul class="klcom-user-list user-cols-<?php echo $cols;?>"> <?php foreach ( $users as $user ){ $cover_photo = klcom_get_cover_url( $user->ID ); $group = klcom_get_user_group( $user->ID ); ?> <li class="klcom-user-item"> <div class="klcom-user-cover"><?php echo klcom_lazyimg($cover_photo, $user->display_name);?></div> <div class="klcom-user-avatar"> <a class="avatar-link" href="<?php echo get_author_posts_url( $user->ID );?>" target="_blank"> <?php echo …
Category: Web

Order users by user role

I have custom fields in the user profile that displays in the team page. It reads "director" "researcher" "graduate" "intern" and some others. When adding a new team member, you pick from a select box with the options. Right now the page displays the users in date of creation order but I need to show them in hierarchy order (all directors first, then the researchers, then graduate, etc, etc). The new fields for the profile are in functions.php with the …
Category: Web

How to create pagination for users list using custom array?

After searching I didn't found any solution, So I'm wondering how can I create pagination for users list like that? I'm highly appreciated your help, Thanks. <?php global $wp_query; $topuser = array(); $avatar_size = 100; $args = array( 'role__in' => array('contributor', 'author'), 'hide_empty' => '1' ); $users = get_users( $args ); foreach ( $users as $user ) { $query = get_posts( array('author' => $user->ID, 'cat' => '3', 'numberposts' => -1, 'post_type' => 'post' )); $counter = 0; $post_count = count_user_posts( …
Category: Web

Filter to wp_list_authors

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, …
Category: Web

Top Authors list by highest post views with Ajax pagination

I'm trying to create an users list to sort all users by the highest post views for each user, I added $output = array_slice($topuser, 0, 10); to get 10 users when i click load more in the next page, but this is repeating the first 10 users only! After searching i found is need to add $paged and $offset to get the next page for the next users! But sorry, I don't know how :( I'm highly appreciated your time …
Category: Web

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.