- This topic has 5 replies, 4 voices, and was last updated 6 years, 4 months ago by
Tom.
-
AuthorPosts
-
January 29, 2019 at 12:04 pm #795893
Matthias
Hi i want a Author box below my post, it wont show the description and doesnt show the photo/gravatar i use as an author: I used this for it
<?phpglobal $post;
$author_id = $post->post_author;
?>
<?php echo get_avatar( get_the_author_meta( $author_id )); ?><h5 class=”author-title”><?php printf( esc_attr__( ‘About %s’, ‘the author’ ), get_the_author_meta( ‘display_name’) );?></h5>
<p class=”author-description”><?php echo wp_kses( get_the_author_meta( ‘description’ ), null ); ?></p>
But it wont show the author description
January 29, 2019 at 4:32 pm #796080Leo
StaffCustomer SupportHi there,
Have you solved this?
The topic is marked as resolved.
December 19, 2019 at 1:26 am #1108554Simone Longato
Hi,
I have the same problem in my web marketing blog https://www.magnetmarketing.it/blog/.
I would like to show an Author informations (name, gravatar, description) box below my post.
Can you help me please?
December 19, 2019 at 9:57 am #1109012Tom
Lead DeveloperLead DeveloperHi there,
You can:
1. Add a Hook Element: https://docs.generatepress.com/article/hooks-element-overview/
2. Set the hook toafter_content
3. Check the Execute PHP option
4. Add this as the hook content:<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"><?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> </div> </div>5. Set the Display Rules.
Then, just add this CSS to your site:
.author-box { padding: 4%; margin-top: 60px; font-size: 1em; display: -webkit-box; display: -ms-flexbox; display: flex; }Hope this helps 🙂
December 20, 2019 at 12:46 am #1109446Simone Longato
Hi Tom,
thanks, it’s working!
Is it possible add related posts below the single post too?
December 20, 2019 at 8:21 am #1109894Tom
Lead DeveloperLead DeveloperRelated posts are more complicated. Any chance you can open a new topic and we’ll explore those options?
-
AuthorPosts
- You must be logged in to reply to this topic.