- This topic has 5 replies, 2 voices, and was last updated 1 year, 6 months ago by
Tom.
-
AuthorPosts
-
June 28, 2019 at 2:34 pm #944241
Ravi Dixit
I have created an Author box using these codes.
Added a Hook at after_content:
<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"><?php printf( esc_attr__( 'About %s', 'the author' ), get_the_author_meta( 'display_name') );?></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>" title="Read more"> ... </a> </div> </div> </div>
and this CSS:
.author-links a { font-size: 3em; line-height: 0.5em; float: right; } .author-box { padding: 4%; margin-top: 60px; font-size: 0.8em; display: -webkit-box; display: -ms-flexbox; display: flex; -ms-flex-wrap: wrap; flex-wrap: wrap; } .author-box .avatar { width: 30px; border-radius: 100%; margin-right: 20px; } h5.author-title { margin-bottom: 0.5em; }
Everything is working fine except for Gravatar images of the author.
Please help me with this.
June 28, 2019 at 3:44 pm #944251Tom
Lead DeveloperLead DeveloperHi there,
Instead of this:
<?php echo get_avatar( get_the_author_meta( $author_id )); ?>
Can you try this?:
<?php echo get_avatar( get_the_author_meta( 'ID' ) ); ?>
Let me know π
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/
Ongoing Development: https://generatepress.com/ongoing-developmentJune 28, 2019 at 4:00 pm #944264Ravi Dixit
Hi, Tom!
Thanks for this, It is working.
How can I create a border and change the background colour of the box?
May I ask you some off-topic questions?
Just curious to know about languages need to learn to create a WordPress theme and Plugins?
I inspired by you a lot after using GeneratePress from last 2 years.
June 28, 2019 at 4:11 pm #944270Tom
Lead DeveloperLead DeveloperSomething like this should work:
.author-box { background-color: #efefef; border: 1px solid #dddddd; }
Thank you! I would say PHP, CSS and Javascript are the best languages to dive into if you’re interested in WordPress development π
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/
Ongoing Development: https://generatepress.com/ongoing-developmentJune 28, 2019 at 5:12 pm #944291Ravi Dixit
Thanks, A lot Tom!
I will definitely learn these languages.
June 29, 2019 at 8:00 am #944661Tom
Lead DeveloperLead DeveloperGlad I could help π
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/
Ongoing Development: https://generatepress.com/ongoing-development -
AuthorPosts
- You must be logged in to reply to this topic.