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 ; } ?>

This entry was posted in General on by .

About Andy Wibbels

Andy is an award-winning blogger and author of the book Blogwild! A Guide for Small Business Blogging. His work has been featured in The Wall Street Journal, USA Today, Entrepreneur, Wired, Business Week, Forbes, and other national and international media. He was worked at several San Francisco startups including Typepad, Get Satisfaction, SInMobi, Keas, and Mindjet. Currently, Andy is Director of Marketing at Lucidworks. Tw · Fb · G+ · Li

Leave a Reply

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