Created
February 21, 2012 20:55
-
-
Save danielbachhuber/1878875 to your computer and use it in GitHub Desktop.
Conditionally load resources based on page slug
This file contains hidden or 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 | |
add_action( 'wp_enqueue_scripts', 'db_conditionally_enqueue_scripts' ); | |
function db_conditionally_enqueue_scripts() { | |
// Don't do anything if it's not the proper page slug | |
if ( !is_page( 'my-page-slug' ) ) | |
return; | |
wp_enqueue_script( 'jquery' ); | |
wp_enqueue_script( 'jwplayer',' | |
http://video.ted.com/assets/player/js/jwplayer_5_7.js' ); | |
wp_enqueue_script( 'db-tabs-js', get_template_directory_uri() . '/js/tabs.js', array( 'jquery' ) ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment