- This topic has 9 replies, 3 voices, and was last updated 4 years, 11 months ago by
Leo.
Viewing 10 posts - 1 through 10 (of 10 total)
-
AuthorPosts
-
November 20, 2020 at 6:52 am #1539055
Fabien
Hi,
Is there a way to change the avatar size in the author page ?
Thanks,
Fabien
November 20, 2020 at 8:59 am #1539189Leo
StaffCustomer SupportHi there,
Any chance you can link us to the page in question?
You can use the private information field.
Let me know 🙂
November 21, 2020 at 8:37 am #1540205Fabien
Here you go !
November 21, 2020 at 8:47 am #1540213David
StaffCustomer SupportHi there,
Try this CSS:
.archive.author .avatar { border-radius: 50%; height: 80px; width: 80px; }November 21, 2020 at 8:51 am #1540217Fabien
Thanks but the quality is not so good as the image is loaded in 50px due the following function :
function generate_filter_the_archive_title( $title ) { if ( is_category() ) { $title = single_cat_title( '', false ); } elseif ( is_tag() ) { $title = single_tag_title( '', false ); } elseif ( is_author() ) { /* * Queue the first post, that way we know * what author we're dealing with (if that is the case). */ the_post(); $title = sprintf( '%1$s<span class="vcard">%2$s</span>', get_avatar( get_the_author_meta( 'ID' ), 50 ), get_the_author() ); /* * Since we called the_post() above, we need to * rewind the loop back to the beginning that way * we can run the loop properly, in full. */ rewind_posts(); } return $title; }Isn’t is a filter in order to change the loaded size ?
November 21, 2020 at 8:53 am #1540219David
StaffCustomer SupportThis line in the filter:
get_avatar( get_the_author_meta( 'ID' ), 50 )Change the
50to whatever size in pixels you require.November 21, 2020 at 9:04 am #1540229Fabien
Yes, but it means I have to edit core templates right ?
November 21, 2020 at 11:03 am #1540351Leo
StaffCustomer SupportYou can use the
get_the_archive_titlefilter with a PHP snippet like this:function lh_filter_the_archive_title_increase_author_image_size( $title ) { if ( is_category() ) { $title = single_cat_title( '', false ); } elseif ( is_tag() ) { $title = single_tag_title( '', false ); } elseif ( is_author() ) { the_post(); $title = sprintf( '%1$s<span class="vcard">%2$s</span>', get_avatar( get_the_author_meta( 'ID' ), 100 ), get_the_author() ); rewind_posts(); } return $title; } add_filter( 'get_the_archive_title', 'lh_filter_the_archive_title_increase_author_image_size', 50);Adding PHP: https://docs.generatepress.com/article/adding-php/
November 21, 2020 at 12:09 pm #1540406Fabien
Thanks Leo, works like a charm !
November 21, 2020 at 12:20 pm #1540412Leo
StaffCustomer SupportNo problem 🙂
-
AuthorPosts
Viewing 10 posts - 1 through 10 (of 10 total)
- You must be logged in to reply to this topic.