Return to Snippet

Revision: 32600
at September 30, 2010 00:48 by stephcode


Initial 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'); ?>
}
?>

Initial URL
http://www.wprecipes.com/how-to-use-multiple-custom-headers-on-a-wordpress-theme

Initial Description
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:

Initial Title
Use multiple custom headers on a WordPress theme

Initial Tags
header, wordpress

Initial Language
PHP