Hi,
In order to add some custom code / functionality to just one page of my site, I’ve set up a custom_header under the “Custom Fields” metabox together with the following code added to the header.php file (just above the closing </head> tag):
<?php if (is_page()) {
if ($custom_header = get_post_meta($post->ID, ‘custom_header’, true)) {
echo $custom_header;
}
}
?>
This works fine, but I’d rather place the above code within a hook rather than editing the header.php file.
As per your advice in previous thread, I’ve tried adding the above lines of code to wp_head instead of in header.php, but it didn’t seem to work (i.e. there is just a blank space on the page between the navigation bar and footer).
It’s working fine when I have the lines of code inserted directly in header.php, so I’m guessing it’s not executing when included in wp_head? I’ve double checked and I do have the Execute PHP box ticked (and Disable hook is empty i.e. unchecked). Please advise whether my code above is correct for inclusion in wp_head and that wp_head is the correct hook to be using.
Many thanks