Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* IN YOUR TEMPLATE FILE ABOVE THE HEADER CALL */
- add_action( 'body_class', 'add_my_bodyclass');
- function add_my_bodyclass( $classes ) {
- global $post;
- $condition = get_post_meta( $post->ID, 'METABOX_ID', true );
- // Some condition to compare / check
- if ( ! EMPTY( $conditon ) ) :
- $classes[] = 'CUSTOM_CLASS';
- endif;
- $classes[] = '';
- return $classes;
- }
- /* THEN IN THE ENQUE FUNCTION */
- $classes = get_body_class(); // Check body classes must be included
- if ( in_array('CUSTOM_CLASS', $classes) ) :
- wp_enqueue_script( 'video', get_template_directory_uri() . '/assets/js/jquery.background-video.js', array( 'jquery' ), '1.0.0', true );
- endif;
Add Comment
Please, Sign In to add comment