- This topic has 3 replies, 2 voices, and was last updated 4 years, 11 months ago by David.
-
AuthorPosts
-
May 25, 2019 at 1:42 am #910300Anton
Hi team,
I’m trying to add the author picture to my posts, as per this thread: https://generatepress.com/forums/topic/add-author-photo-for-each-post-in-blog-home/
But it’s not working for me.
All I want is for the author picture to appear next to the author name in the beginning of every post.
My coding skills are that of a pensioner who takes courses to learn Microsoft Word. Almost.
In the thread above you guys instructed to add this:
add_filter( ‘generate_post_author_output’, ‘tu_add_author_gravatar’ );
function tu_add_author_gravatar() {
printf( ‘ <span class=”byline”>%1$s</span>’,
sprintf( ‘<span class=”author vcard” itemtype=”http://schema.org/Person” itemscope=”itemscope” itemprop=”author”>%1$s %5$s<span class=”author-name” itemprop=”name”>%4$s</span></span>’,
__( ‘by’,’generatepress’),
esc_url( get_author_posts_url( get_the_author_meta( ‘ID’ ) ) ),
esc_attr( sprintf( __( ‘View all posts by %s’, ‘generatepress’ ), get_the_author() ) ),
esc_html( get_the_author() ),
get_avatar( get_the_author_meta( ‘ID’ ) )
)
);
}I’ve tried adding that to my function file (child’s theme), but that didn’t work. When I did that, my site had a big white bar appearing at the top of the screen, containing some of the above codes, in black text.
I also tried adding it under “Extra CSS”, but WordPress then gave me a bunch of warnings. I clicked the “update anyway” and published. But no success, nothing happened.
If I want to add a round gravatar picture for every author in their posts, how do I do it? I would be very grateful for step-by-step instructions on how to do it. What I wish to have is exactly what is described in the other thread.
Thank you very much in advance and have a good weekend!
Best regards,
AntonMay 25, 2019 at 5:08 am #910379DavidStaffCustomer SupportHi there,
sounds like something weird with you child theme.
Try adding the Code using the Code Snippets plugin, you can find a link within this article. If that works we can then help with styling the gravatar:
May 25, 2019 at 6:51 am #910523AntonHello David,
Works like a charm with the Code snippet plugin.
I will get back on here if I would need further assistance.
Thanks for the quick help!
Best regards,
AntonMay 25, 2019 at 12:46 pm #910736DavidStaffCustomer SupportGlad to be of help
-
AuthorPosts
- You must be logged in to reply to this topic.