Created
August 14, 2013 19:56
-
-
Save hereswhatidid/6234943 to your computer and use it in GitHub Desktop.
Detect shortcode use and enqueue scripts accordingly
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function detect_video_shortcode() { | |
global $post; | |
if ( has_shortcode( $post->post_content, 'video') ) { | |
wp_enqueue_script( 'video-player-specific-script'); | |
} | |
} | |
add_action( 'wp_head', 'detect_video_shortcode'); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment