Site logo

Archived topic

the is the exact function to get rounded post author output with image

7 replies · Started by subham sarkar on April 8, 2018

Viewing posts 1–8 of 8

Hi,

I am complete newbies really don't have any idea about coding and all to get something like this

http://prntscr.com/j2r0fw

I tried this filter but it shows the square image which is large enough to overlap the name

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<a href="%2$s" title="%3$s" rel="author"><span class="author-name" itemprop="name">%4$s</span></a></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' ) )
		)
	);
}

Hi there,

You would need a bit of CSS to make the image round.

Can you link me to the site in question?

You can edit the original topic and use the private URL field.

Let me know :)

yes did this please have a look

Hmm I'm not seeing the author picture showing up anywhere?

Can you guide me to a post where it's showing?

no, I remove the function because it was not in place so I like to get something like this http://prntscr.com/j2r0fw

can you please guide me

anyway leave it I don't think I can do this

Along with the function you were using, try adding this CSS:

.byline img {
    height: 25px;
    width: auto;
    border-radius: 50%;
    display: inline-block;
    margin: 0 5px;
    position:  relative;
    bottom: -5px;
}

It should make it look nicer :)

This archived topic is closed to new replies.