Use multiple custom headers on a WordPress theme
October 24, 2008 · Print This Article
Do you ever wanted to have multiple headers on your WordPress blog? If yes, here’s a clear and concise tutorial that will help you to get themost out of your blog headers!
The first thing to do is to create header files. Create as many different headers as you want. In this exemple, I have created 3 custom headers from my theme default file header.php, names headercontact.php, headergallery.php and headerdefault.php.
By using the php include() function and WordPress conditional tags, we can define custom headers easily.
Replace the content of your header.php file with the following code:
<?php
if (is_page('contact')){
<?php include(TEMPLATEPATH.'/headercontact.php'); ?>
}
elseif (is_page('gallery')){
<?php include(TEMPLATEPATH.'/headergallery.php'); ?>
}
else {
<?php include(TEMPLATEPATH.'/headerdefault.php'); ?>
}
?>





















Comments
Got something to say?
You must be logged in to post a comment.