[Resolved] Author picture in the beginning of posts – How to add?

Home Forums Support Author picture in the beginning of posts – How to add?

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #910300
    Anton

    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&#8221; 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,
    Anton

    #910379
    David
    Staff
    Customer Support

    Hi 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:

    https://docs.generatepress.com/article/adding-php/

    #910523
    Anton

    Hello 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,
    Anton

    #910736
    David
    Staff
    Customer Support
Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.