I am trying to add some js code into a website’s footer only on certain pages which have a specific custom field.
This is my code from the functions.php:
So basically I want to load ‘ var shadowbox_conf = etc ‘ only when there is a custom field ‘lightbox’ with the value ‘Shadowbox’.
I also tryied to load this function before the wp_head(); but it doesn’t help.
I am wondering if there is any way to get access to the $post->ID within my function so that I could possibly use get_post_meta().
Might it also depend on the position within the functions.php?
Or is there any other way to include this js code through a function out of the functions.php into the wp_footer?
The topic ‘js code in wp_footer in dependence on custom field value’ is closed to new replies.