There’s currently no option to call a custom header in the same way that you can a sidebar via template tags. What about using Conditional tags in header.php to either load the image for the front page or default to the main header image elsewhere?
Why not just do some include switching in your header file?
<?php
if(is_page('X')) {
include('somepagetoinclude.php');
} elseif(is_page('X2')) {
include('someotherpagetoinclude.php');
} elseif(is_frontpage()) {
do something for frontpage
} else {
if nothing above is matched then do this etc etc...
}
?>
And so on…
If you just want to rotate adverts, why include another whole file for it?
There’s an abundance of rotation scripts no more then a few lines long available for that kind of thing.
t31os,
That may actually work (haven’t tried it just yet), but do you have any solution on how to tackle it from a single post?
Its not really a rotation of ads that I need to run. I need specific codes to only show up when its the front page and then a different set of code for anything thats not on the front page (including pages and single posts).
if(is_single()) {
this is shown if it's a single post page..
}
if(is_page()) {
this is shown if it's a page
}
if(is_front_page()) {
this is shown if it's the front page
}
Or if you need to check it’s not the front page but is a page or single post, then combine them…
if(is_single()) {
this is shown if it's a single post page..
}elseif(is_page()) {
this is shown if it's a page
}elseif(is_front_page()) {
this is shown if it's the front page
}
Really depends what cases they need to match, lets say you wanted to catch when it’s not the frontpage, not a single post page but anything else…
if(!is_front_page() && !is_single()) {
It's not the front page or a single post page..
}
Adding the exclamation ! , is simply like saying NOT…
I found a much easier option.
Since I already had another ‘header’ page written, rather than start off by ‘get_header’ I simply used ‘include_header1.php’ and it worked. So much easier than writing the loops.
t31os, thank you for attempting to help though. I appreciate it a ton, even if I went in a different direction.
If you’re going to use that file as a header.. then use require instead..
<?php require('yourfilename.php');?>
or..
<?php require_once('yourfilename.php');?>
Ensures pages that should include the header can’t be loaded without it.
Otherwise i could potentially call your files directly without them including the header page… (not sure if WP would catch it, but just incase).