Archived topic
How to delete avatar/gravatar on author box
5 replies · Started by Willya on March 18, 2020
Hi, long time no see this support forum. I miss it actually, especially the awesome support from Tom and Mike.
Okay, so I have added the author box on my site with these code without installing any plugin. (these codes I take by other source).
And I have succesfully added the author box on my site, BUT I want the author box ONLY show my BIO, I dont confident to use my photo.
First, I add an Element on hook:
<div class="author-box">
<div class="avatar">
<?php echo get_avatar( get_the_author_meta( 'ID' ) ); ?>
</div>
<div class="author-info">
<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>
<div class="author-links">
<a href="<?php echo get_author_posts_url( get_the_author_meta( 'ID' ) ); ?>" title="Read more">
Read about me
</a>
</div>
</div>
</div>
And This is the CSS style:
.author-box {
padding: 3%;
padding-bottom: 25px;
margin-top: 60px;
font-size: 0.9em;
background-color: #ecf2f8;
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
border: 1px solid #1d73be;
}
.author-box .avatar {
width: 400px;
height: auto;
border-radius: 100%;
margin-right: 30px;
}
h5.author-title {
margin-bottom: 0.1em;
font-weight: 600;
font-size: 20px;
}
.author-description {
line-height: 1.6em
}
.author-links a {
font-size: 15px;
line-height: 20px;
float: left;
}
@media (max-width: 768px) {
.author-box {
padding: 20px;
padding-bottom: 20px;
margin-top: 100px;
flex-direction: column;
text-align: center;
}
.author-box .avatar {
margin-right: 0;
margin-bottom: 40px;
width: 100%;
margin-top: -35px;
}
.author-box .avatar img {
max-width: 100px;
}
.author-links a {
float: none;
align-self: center;
}
.author-description {
text-align: left;
}
}
I just want to delelte the avatar/photo/gravatar on author box. How/which line should I delelte?
Thanks
Hi there,
remove this from the HTML/PHP:
<div class="avatar">
<?php echo get_avatar( get_the_author_meta( 'ID' ) ); ?>
</div>
You won't need any CSS rule that begin with .author-box .avatar either
Thank you for fast reply, David! It works!
You're welcome
Following up on this: How can I use that element as a widget (instead of a hook)
Thx for sharing the code by the way!
Hi there,
this Topic provides a way to create a Shortcode version that you can then add to a Widget area or anywhere else:
https://generatepress.com/forums/topic/add-author-bio-in-sidebar-with-any-plugin/#post-1001239