Archived topic
Adding Bio to author page and adjustments
5 replies · Started by Dominic on September 3, 2020
Hi,
I’m a bit lost here.
– How do I add the user bio above the blog content?
What shortcode do I use to do this and what element should I add?
Got this already running form all archives
https://www.screencast.com/t/pzH5HOQrt
https://www.screencast.com/t/065twwpt
– How can I get rid of the “nothing to be found” message when the author has no posts yet (we still want to display the bio
– Where can I set the hero image for each individual author page?
thank you for the help
Hi there,
Add this PHP Snippet to your site:
add_shortcode( 'author_bio', function() {
ob_start();
echo wp_kses( get_the_author_meta( 'description' ), null );
return ob_get_clean();
} );
https://docs.generatepress.com/article/adding-php/
Then you can add this shortcode: [author_bio]
WordPress doesn't support featured images for users.
You would have to use CSS to set each authors hero background like so:
.author-dominic-heselmans .page-hero {
background-image: url('url_for_author/image.jpg');
}
Hi David,
Thank you very much for the feedback.
I'm not 100% sure where to add the shortcode [author_bio] ?
If you want it to show above the blog post content then generate_before_content should work:
https://docs.generatepress.com/article/hooks-visual-guide/#single-post
Let me know :)
thank you :)
No problem :)