Site logo

Archived topic

Can I change what's shown by {{post_author}} tag?

3 replies · Started by Jan on August 10, 2017

Viewing posts 1–4 of 4

Hi,

when I use {{post_author}} tag in Page Header, it shows the_author_meta('nickname') information. Is it possible to change it to the_author_meta('display_name')?

I tried to create custom shortcode ( https://generatepress.com/forums/topic/single-post-page-header-issues/#post-350710 ) for that purpose, but the returned value is shown right after .inside-content-header element, not in the place I put the shortcode in.

thanks

Try this instead:

add_shortcode( 'avatar', 'tu_author_avatar' );
function tu_author_avatar() {
    ob_start();
    global $post;
    $author_id = $post->post_author;
    get_avatar( $author_id, 32 );
    return ob_get_clean();
}

Thank you, Tom. It's working now. :)

You're welcome :)

This archived topic is closed to new replies.