Site logo

Archived topic

Gravatar Image is not Showing on Author Profile

5 replies · Started by Chandresh Bisht on February 12, 2020

Viewing posts 1–6 of 6

Hi,
I am using the following CSS for showing Author box but the author profile picture is not showing.

.author-box {
	padding: 0 20px;
	font-size: 14px;
	background-color: #fff;
	display: -webkit-box;
	display: -ms-flexbox;
	display: flex;
}
.author-box .avatar {
	width: 250px;
	height: auto;
	border-radius: 100%;
	margin-right: 30px;
}
p.author-title {
	font-size: 18px;
	margin-bottom: 0.1em;
	font-weight: 600;
}
.author-description {
	line-height: 1.6em
}
@media (max-width: 768px) {
	.author-box {
		padding-bottom: 0px;
	}
	.author-box .avatar {
		margin-right: 10px;
		width: 150px;
	}
	.author-box .avatar img {
		max-width: 100px;
	}
}

Gravatar Image is showing on comments but not showing on Author Box.

You can check here at one of the posts of my site for Amazon Upcoming Sale

Looking for quick reply.

Thanks

Hi there,

how is the Author Profile being added to the Site ?
Are you using a plugin or code. If its code can you share it here.

It is updated through code.
Added the following code on the element.

<div class="author-box">
    <div class="avatar">
        <?php echo get_avatar( get_the_author_meta( ‘ID’ ), 250 ); ?>
    </div>
    <div class="author-info">
		<p class="author-title" itemprop="author" itemscope itemtype="http://schema.org/Person">
			<span itemprop="name"><?php printf( get_the_author_meta( 'display_name') );?></span>
		</p>
        <div class="author-summary">
            <p class="author-description"><?php echo wp_kses( get_the_author_meta( 'description' ), null ); ?></p></div>
    </div>
</div>

Its the pretty quote marks ‘ID’ in your code thats the problem.
The line should read like so:

<?php echo get_avatar( get_the_author_meta( 'ID' ), 250 ); ?>

Working fine.
Thanks a lot.

You're welcome

This archived topic is closed to new replies.