Site logo

Archived topic

Need help customizing author box

1 reply · Started by Johanna on June 24, 2019

Viewing posts 1–2 of 2

I added a hook to GP elements to add an author box:

<div class="author-box">
	<?php 
	global $post;
	$author_id = $post->post_author;
	?>
	<div class="avatar"><?php echo get_avatar( get_the_author_meta( $author_id ));?></div>
<h5 class="author-title" itemprop="author" itemscope itemtype="http://schema.org/Person">
	<span itemprop="name"><?php printf( get_the_author_meta( 'display_name') );?></span>
</h5><div class="author-summary">
		<p class="author-description"><?php echo wp_kses( get_the_author_meta( 'description' ), null ); ?></p>
		<div class="author-links">
			<a href="<?php echo get_author_posts_url( get_the_author_meta( 'ID' ) ); ?>" title="Read more">
			...
			</a>
		</div>
	</div>
</div>

Check my post and you will see that it works but I want to insert an author image to this code.

Any idea how to do it?

Hi there,

try changing this line:

<div class="avatar"><?php echo get_avatar( get_the_author_meta( $author_id ));?></div>

to:

<div class="avatar"><?php echo get_avatar( get_the_author_meta( 'ID' ));?></div>

This archived topic is closed to new replies.