function add_js_one_col_wpse_107240() {
if (is_page()) {
$pobj = get_queried_object();
if(!empty(get_post_meta($pobj->ID,'one-col',true)) {
wp_enqueue_script(/* ... */);
} else {
wp_enqueue_script(/* ... a different script ... */);
}
}
}
add_action('wp_enqueue_scripts','add_js_one_col_wpse_107240');
get_queried_object
will get you the page information. It will
be a WP_Post
object on a “Page”. global $post
should probably
work too, but this is cleaner.
- Use the
WP_Post
object information to check for the custom meta
field. enqueue scripts accordingly. You don’t say what the value
of one-col
is so I checked for any value at all.
- Hook the whole thing to
wp_enqueue_scripts
.