Archived topic
Author Box
9 replies · Started by Sagar on May 9, 2020
Hello there! Is there any solution to add the author box at the bottom of every post without adding a plugin?
If yes, please tell me the full process, how can I add that on my site.
I think you can find here
https://generatepress.com/forums/topic/author-box-4/#post-975518
I have installed the security plugin on my site and that plugin is causing the isssue to excute the php.
Error I get:
Unable to execute PHP as DISALLOW_FILE_EDIT is defined.
Thanks Suraj
You can add the PHP Snippet provided here to allow PHP execution just in the GP Hook Element:
https://docs.generatepress.com/article/generate_hooks_execute_php/
Thanks, David. It worked perfectly fine. Could you please customize the PHP code? I want to set the link in the author name with the author page URL.
try this instead it will add the link to the Author Title:
<div class="author-box">
<?php global $post; ?>
<div class="avatar"><?php echo get_avatar( get_the_author_meta( 'ID' )); ?></div>
<h5 class="author-title"><a href="<?php echo get_author_posts_url( get_the_author_meta( 'ID' ) ); ?>" title="Read more"><?php printf( esc_attr__( 'About %s', 'the author' ), get_the_author_meta( 'display_name') );?></a></h5>
<div class="author-summary">
<p class="author-description"><?php echo wp_kses( get_the_author_meta( 'description' ), null ); ?></p>
</div>
</div>
Would you mind on writing like this Written By "Author Name" on " Published Date"?
Hi there,
Try this:
<div class="author-box">
<?php global $post; ?>
<div class="avatar"><?php echo get_avatar( get_the_author_meta( 'ID' )); ?></div>
<h5 class="author-title">Written by <a href="<?php echo get_author_posts_url( get_the_author_meta( 'ID' ) ); ?>" title="Read more"><?php echo get_the_author_meta( 'display_name'); ?></a> on <?php echo generate_do_post_meta_item( 'date' ); ?></h5>
<div class="author-summary">
<p class="author-description"><?php echo wp_kses( get_the_author_meta( 'description' ), null ); ?></p>
</div>
</div>
Thank you Tom :)
No problem :)