/ Published in: PHP
URL: http://www.wprecipes.com/how-to-use-multiple-custom-headers-on-a-wordpress-theme
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:
Expand |
Embed | Plain Text
<?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'); ?> } ?>
You need to login to post a comment.
