This is driving me mad… wordpress does allow php code to come before the header is called right?
I really cant see what the issue is!… Any help would be really great
Ok done a bit of testing, pretty much figured out that no matter what I call on the page before the header is included this is ignored other than the template call..is this correct?
Last chance at getting an answer to this…. I realise the forums are crammed with 2.5 disasters but any help with this would be great.
Hi Rob,
Not that it’s going to be much “help”, but I can confirm that you can’t add that type of information before the header call. I’ve tried it every which way over and over again, it seems that WordPress kills those variables you’re writing.
An idea that I had was to call whatever variable is used to determine a Page Template, however I never got any takers on my support request.
I’m not the master of PHP, though, but perhaps you might have the ability to look into this.
Thanks clicknathan, it did occur to me that it must be WP doing something as my code all seems fine!
The only thing I can think to do now is use the is_template tag and call the style and images that way, still don’t know whether it will work though and think this conditional tag is only available in 2.5? May be wrong
Did you have any luck with is_template, Rob?
To be honest I scratched the idea and made seperate images on each template page π My reasons are as follows:
1) The website I need it for is currently on 2.3.3 and I am not really prepared to upgrade yet until 2.5 has more of its bugs ironed out.
2) I have never really experimented with is_page_template and I dont want to upgrade to 2.5 just to test to see it works.
3) I have a deadline of Thursday for this project so experimental time is nill!
I will keep this thread open and If I figure anything out I will post it up.
Meanwhile, anyone who knows what is_page_template is capable of and if it can be used in wp header or not, would be much appreciated if some light could be shed! Thanks
hey guys, check the thread you have going here, mfields has posted a (possible) solution… I’m doing something similar with is_page_template. if you do wanna use is_page_template(), make sure you pass it the template filename, not the name you assign it within that file. eg use is_page_template('page-about.php') not is_page_template('about'). The is_page_template() function lives in ‘wp-includes/post-template.php’ in your WP2.5 install. If you wanna test how this works, put the following in your sidebar: `<php
/* test page template */
if (is_page_template(‘page-home.php’)) {
echo (‘<h2>Home template</h2>’);
} else {
$custom_fields = get_post_custom_values(‘_wp_page_template’,$post->ID);
$page_template = $custom_fields[0];
echo (‘<h2>’ .$page_template. ‘</h2>’);
}
?>` (i grabbed the second half of this directly from the post-template.php include, so if you’re running WP2.3, maybe see if you can manually retrieve the current page template using the ‘_wp_page_template’ call as above? )