Display a Different Header Image on Each Page of Your WordPress Site
Thursday’s WordPress Q & A Session covers some pretty familiar territory: dynamic header images.
A reader of this blog named Allan has graced us with today’s question, in the hopes that some of you WordPress magicians might be able to help him out. He asks:
How do you display a different header image in WordPress, according to which page is currently being viewed?
For example: Your header.php file contains a Flash-based header image, followed by the primary navigation menu. This is the desired view on the home/index page, but you do not want the Flash to be visible on any other page of your site.
WordPress allows you to create templates for customizing individual pages, but this only allows you to add or remove the header as a whole. So how can you make WordPress serve up a different header image on different pages of the site?
This is a question that most WordPressers have asked themselves at some point or another. With dynamic header images built into the default Twenty Ten and Twenty Eleven WordPress themes, a lot of folk are eager to replicate this functionality on their own sites.
So tell us, brave WordPress warriors, how would you approach this? What solution can you suggest to our friend Allan? If you have an opinion on this matter, kindly leave a comment at the end of this article and share the love.
Please try to keep it as simple as possible. There are usually several different ways to achieve something in WordPress, but we’re trying to gather accessible and straightforward advice that the greatest number of users can benefit from.
P.S. Have you submitted your own WordPress question yet? We’re looking for interesting and engaging questions on anything to do with WordPress, and every question that we select for publication wins the author a 3 month membership at WPMU DEV (worth $159). Get the full details here.
Photo: Zach Stern.