Keep an author signature

Some bloggers like to invite others to be a guest authors on their blog. Mostly, they will have a short author description at the end of an entry. However, some blogger like to have a signature as well, and the signature may be only for the main author, just to make it more porminent when viewing on the front page.

Blog like eczema treatment or some news related articles like to have multiple authors but still keep a main author.

Signature

That is where get_the_author() comes in.

When an entry is published, get_the_author() will look and display the author name. In order to only display a certain author’s name, we need to tell it by:

<?php
$author = get_the_author(); // Check author
if($author == 'Andrew') // Check if the author name is "Andrew"
{ ?>
<div class="post-signature">Andrew</div> // Show this if it is "Andrew"
<?php } else { //No signature for others } ?> // Show nothing if it is guest author

There you have it…

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>