Advertisement
brucewhealton

Enqueue Scripts for Wordpress Theme

Sep 2nd, 2014
230
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.01 KB | None | 0 0
  1. <?php
  2.  
  3. /*
  4.  * To change this license header, choose License Headers in Project Properties.
  5.  * To change this template file, choose Tools | Templates
  6.  * and open the template in the editor.
  7.  */
  8.  
  9. function wpbootstrap_scripts_with_jquery()
  10. {
  11.     // Register the script like this for a theme:
  12.     wp_register_script('bootstrap-script', get_template_directory_uri() . '/bootstrap/js/bootstrap.min.js', array('jquery'), 20140902, true);
  13.     // For either a plugin or a theme, you can enqueue the script:
  14.     wp_enqueue_script('bootstrap-script');
  15.    
  16.     wp_register_script('custom-script', get_template_directory_uri() . '/bootstrap/js/custom.js', array('bootstrap-script', 'jquery'), 20140902, true);
  17.     // For either a plugin or a theme, you can enqueue the script:
  18.     wp_enqueue_script('custom-script');
  19.    
  20.     wp_register_script('respond', get_template_directory_uri() . '/bootstrap/js/respond.js');
  21.     wp_enqueue_script('respond');
  22. }
  23.  
  24. add_action('wp_enqueue_scripts', 'wpbootstrap_scripts_with_jquery');
  25. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement