Friday, 11 November 2016

Show Post Author

How to show the author in a WordPress post?

To display information about the post author, open the single.php file of your WordPress theme and find where the content is displayed:
<?php the_content(''); ?>
After this, add the following lines in your theme:
<?php if ($lw_post_author == "true" && is_attachment() != TRUE) : ?>
<div >
<div >
<?php echo get_avatar( get_the_author_id(), '28' ); ?>
</div>
<div >
<h4>
<?php _e('Author','lightword'); ?>: <a href="<?php the_author_url(); ?>"><?php the_author(); ?>
</a>
</h4>
<?php the_author_description(); if(!get_the_author_description()) _e('No description.
Please update your profile.','lightword'); ?>
</div>
<div >
</div>
</div>
<?php endif; ?>
This will add information about the post author on your site. Simply update your style.css in order to make this block look the way you want.

No comments :
Write comments