Show a Certain Author’s Graphic Header in an Author Archive Template

Let’s say every author on our blog has a fancy schmancy header. When readers are reading the Author Archive (author.php) and reading just that one particular author’s posts, how do we tell WordPress when to pop which graphic? Off the author ID.
The is_author() conditional tag can tell us 1) if we are viewing an author archive and 2) who that author is (we can use the author ID or nickname.
So we do a little test to see if Jim, who is author #2, is being displayed and if so, we pop his graphic header. And the same for Tim (author #4).
<?php if (is_author(‘2’)) { ?>Jim’s header graphic HTML<?php ; } ?>
<?php if (is_author(‘4’)) { ?>Tim’s header graphic HTML<?php ; } ?>






Leave a Reply

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