Tutorial by Examples

If you want to add custom.js script that is located in the js/ folder of your theme, you'll need to enqueue it. In functions.php add <?php add_action( 'after_setup_theme', 'yourtheme_theme_setup' ); if ( ! function_exists( 'yourtheme_theme_setup' ) ) { function yourtheme_theme_setup()...
add_action( 'wp_enqueue_scripts', 'enqueue_my_styles_and_scripts' ); /** * Enqueue scripts (or styles) conditionally. * * Load scripts (or stylesheets) specifically for IE. IE10 and above does * not support conditional comments in standards mode. * * @link https://gist.github.com/wpsc...
You can use conditional operators in WordPress to enqueue scripts on specific pages of your Website. function load_script_for_single_post(){ if(is_single()){ wp_enqueue_script( 'some', get_template_directory_uri().'/js/some.js', array...

Page 1 of 1