Showing the authors username and bio on custom author.php

I have this code I'm using to create a custom author.php, which is working great to show that users posts and it's children etc: <?php get_header(); ?> <?php $curauth = (isset($_GET['author_name'])) ? get_user_by('slug', $author_name) : get_userdata(intval($author)); ?> <div class="auth-name"> <?php if ( '' != get_the_author_meta( 'user_description' ) ) echo apply_filters( 'archive_meta', get_the_author_meta( 'display_name' )); ? > </div> <div class="auth-desc"> <?php if ( '' != get_the_author_meta( 'user_description' ) ) echo apply_filters( 'archive_meta', get_the_author_meta( 'user_description' )); ?> </div> <div class="header"> <h1>Buckets made …
Category: Web

How to make an author archive only for certain user role and show related CPT

Scenario I made a CPT where I'm taking the stakeholder's ID as a custom field. All the stakeholders are actually a WordPress' Registered User with a different role stakeholders - because at some point I need them to login to post their own content. So what actually I'm doing, I'm grabbing the userID and passing them as a custom field to that CPT. Now I need to make a custom author archive, only specific to that role, where I can …
Category: Web

Check For get_post_meta on Author Archive Page

I've had a good look thru the Similar Questions for an answer and i'm looking to check if a value for a custom field key on single posts has been added using get_post_meta(); however i want to use this check on the author archive page. This is my code in functions.php global $wp_query; $post = $wp_query->get_queried_object_id(); $meta = get_post_meta( $post->ID, 'key', true ); if ( $meta ) : Update : This function doesn't work on the author archive page. function …
Category: Web

Wordpress redirect to a subpage - how to create a template for subpage?

So I have the author.php which is the author page showing all information and posts for the author. I'm trying to create a subpage template (example.php) for the auhthor.php so that I can showcase custom posts on a separate page like - www.abc.com/author/example How can I create a subpage template so that it will also take the author details and be able to present custom posts on the sub page.
Category: Web

Show all people who commented on all posts by an author

I need to make a feed, showing everyone, or at least the last ones who commented on an author's posts. I've tried it in different ways and I haven't been able to. Can you do it? example: Juliana commented on your post xxxxxxxx Edu commented on your post yyyyyyyyyyy Marcos commented on your post xxxxxxxxxx Luis commented on his post zzzzzzzzzzz João commented on your post yyyyyyyyyyyy
Category: Web

How to display buttons - next / previous author. On the author's page

I want to be able to list authors on the site inside their personal pages. But I do not understand what request to create, how to display the previous user or the next one relative to the current author page. As I see it. On the author's page, there is a button (previous user) and a button (next user) I am not good at coding, but I will be glad to hear advice in which I can look for a …
Category: Web

Get user posts with custom WP_Query on author.php

I try to show custom post list with WP_Query on author.php like this: <?php $args = array( 'post_type' => 'post', 'author' => 'get_queried_object_id()', 'posts_per_page' => 9 ); $the_query = new WP_Query( $args ); if ( $the_query->have_posts() ) : while ( $the_query->have_posts() ) : $the_query->the_post(); ?> <figure><a href="<?php the_permalink(); ?>"><img src="<?php if ( has_post_thumbnail() ) : the_post_thumbnail(); endif; ?>" alt="<?php the_title(); ?>"></a></figure> <h5><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h5> <?php endwhile; wp_reset_postdata(); ?> <?php else : ?> <p><?php _e( 'No posts by …
Category: Web

List user comments in author page

I'm trying to display a list of the author comments in the authors page but it only shows No comments made. How can I list user comments in the authors page? <?php $args = array( 'user_id' => $user->ID, 'number' => 10, // how many comments to retrieve 'status' => 'approve' ); $comments = get_comments( $args ); if ( $comments ) { $output.= "<ul>\n"; foreach ( $comments as $c ) { $output.= '<li>'; $output.= '<a href="'.get_comment_link( $c->comment_ID ).'">'; $output.= get_the_title($c->comment_post_ID); $output.= …
Category: Web

Display all comments or recent comments per user on author page

I have author pages for each author and I want to see all of their comments (or all of their recent comments) if I click on their nickname. How can I do this? I tried the beneath code, but that does not show the unique comments per user... It just outputs all recent comments from everyone combined, but I don't want that. <?php $author_email = get_the_author_meta( 'user_email' ); $args = array( 'author_email' => $author_email, 'number' => '10' ); $comments = …
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

WooCommerce get_author_posts_url() - Author URL redirecting to shop base

I've noticed that when I have WooCommerce enabled and use get_author_posts_url() it automatically redirects to the 'shop base' when the user's role is Customer. When I change the user to Subscriber get_author_posts_url() works correctly. I've disabled all plugins to systematically identify what was causing the issue and can confirm that it's only when WooCommerce is enabled. I've also flushed rewrites. I've also even tried using $user->add_role( 'subscriber' ) to the user's capabability array. Does anyone know why this is happening …
Category: Web

can't see information on author page that don't have posts

I have page for each author role, but if the author doesn't have any posts I can't get its variables, because the loop is empty. The page returns empty, no avatar, no author name and bio. How do I get WordPress to pull out the author variable if there are no posts? I'm using hello elementor theme and WP User Avatar plugin.
Category: Web

Custom author url and page for another role

I would like to create a custom url and a separate or duplicate the author.php template for another custom role w/o using plugins. I found this related topic but it just modify the author url Override default url for author pages? Something like: mydomain.com/author/foo for all the default roles and mydomain.com/member/john for the new custom role
Category: Web

How to display user role

How to display user role on author page. I have created my own role (group) so I want to display the user role on below the post and on author list. I have tried this code but not working as its calling current_user and its showing current user role in all authors profile <?php $user_roles = $current_user->roles; $user_role = array_shift($user_roles); if ($user_role == 'administrator') { echo 'Administrator'; } elseif ($user_role == 'editor') { echo 'Editor'; } elseif ($user_role == 'author') …
Category: Web

Show author archive pages for authors with no posts

I have one page for each author, but if the author doesn't have any posts I can't get its variables, because the loop is empty. The page returns empty, no avatar, no info and stuff, the whole site is empty. How do I get WordPress to pull out the author variable if there are no posts (what makes no author, but i am on the authors page)..? I'm using twentyeleven as parent theme.
Category: Web

How to fix a specific page (author archive) loading speed?

For some reason, author pages on my blog are loading extremely slow, even for authors that have very few posts, as you can see [here][1]. I am not a developer, but I can understand the code a little bit. Please assist, thank you. <?php // Register Calendar widget scripts function snaplap_widget_calendar_scripts_and_styles(){ wp_register_style( 'LatoWidget', get_stylesheet_directory_uri() . '/js_calendar/css/Lato_300_400_700.css'); wp_enqueue_style( 'Lato' ); wp_register_style( 'FontAwasomeCalendarWidget', get_stylesheet_directory_uri() . '/js_calendar/css/fontawesome.css'); wp_enqueue_style( 'FontAwasomeCalendarWidget' ); wp_register_style( 'stylePersonalCalendarWidget', get_stylesheet_directory_uri() . '/js_calendar/css/style-personal.css'); wp_enqueue_style( 'stylePersonalCalendarWidget' ); // Register and Enqueue a …
Category: Web

About

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