aquaballoon

Wordpress - functions.php

May 29th, 2014
222
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.52 KB | None | 0 0
  1. <?php
  2.  
  3. //wp_enqueue_scripts => init
  4. add_action('init', 'load_Myscript');
  5.  
  6. function load_Myscript() {
  7.   if (!is_admin()) {
  8.      // loading wp-includes/js/jquery/jquery.js
  9.      // wp_enqueue_script('jquery');
  10.  
  11.      // removing WordPress default jquery script
  12.      wp_deregister_script('jquery');
  13.  
  14.      //wp_register_script('jquery', 'http://code.jquery.com/jquery-1.11.0.min.js');
  15.      //wp_enqueue_script('jquery');
  16.  
  17.      // bloginfo('template_url')  vs get_bloginfo('template_url') => http://localhost/wordpress/wp-content/themes/myThemeName/
  18.      // wp_register_script( $handle, $src, $dependencies, $ver, $in_footer );  $in_footer <= true
  19.      wp_register_script('jquery', get_bloginfo('template_url').'/dist/js/jquery.js');
  20.      wp_enqueue_script('jquery');
  21.        
  22.      //wp_register_script('bootstrap', 'http://netdna.bootstrapcdn.com/bootstrap/3.1.1/js/bootstrap.min.js');
  23.      //wp_enqueue_script('bootstrap');
  24.      wp_register_script('bootstrap', get_bloginfo('template_url').'/dist/js/bootstrap.js', array('jquery'), '', true);
  25.      wp_enqueue_script('bootstrap');
  26.  
  27.      wp_register_script('myCode', get_bloginfo('template_url').'/dist/js/myCode.js', array('jquery'), '', true);
  28.      wp_enqueue_script('myCode');
  29.   }
  30. }
  31.  
  32.  
  33. //
  34. //if ( function_exists('register_sidebar') )
  35. //  register_sidebar(array(
  36. //      'before_widget' => '',
  37. //      'after_widget' => '',
  38. //      'before_title' => '<h3>',
  39. //      'after_title' => '</h3>',
  40. //));
  41.  
  42. ?>
  43.  
  44. // myCode.js
  45. $(function() {
  46. $("#bt2").click(function(){
  47. alert("HI");
  48. });
  49. });
Advertisement
Add Comment
Please, Sign In to add comment