Advertisement
Guest User

Untitled

a guest
Feb 21st, 2012
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.51 KB | None | 0 0
  1. // put this in your theme's functons.php
  2.  
  3. // load javascript and stylesheets only on the front end.
  4. if(!is_admin()){
  5. add_action('wp_enqueue_scripts', 'install_rcarousel_javascript');
  6. }
  7.  
  8. function install_rcarousel_javascript() {
  9.  
  10. // put the rcarousel files in a folder called "rcarousel" in your theme
  11. // (wp-content/themes/yourtheme/rcarousel/)
  12. $theme_url = get_template_directory_uri();
  13.  
  14. // register rcarousel and all it's dependend files
  15. wp_register_script('rcarousel',
  16. $theme_url . '/rcarousel/widget/lib/jquery.ui.rcarousel.min.js',
  17. array('jquery','jquery-ui-core','jquery-ui-widget'));
  18. // enqueue all rcarousel javascript files
  19. wp_enqueue_script('rcarousel');
  20.  
  21. // register your own script and put it in a folder js in your theme
  22. // this way we dont need inline javascript
  23. wp_register_script('rcarousel_my_script', $theme_url.'/js/my_script.js', array('rcarousel'));
  24. wp_enqueue_script('rcarousel_my_script');
  25.  
  26. // register the stylesheet for rcarousel
  27. wp_register_style('rcarousel_style', $theme_url .'/rcarousel/widget/css/rcarousel.css');
  28. // enqueue the stylesheet for rcarousel
  29. wp_enqueue_style('rcarousel_style');
  30. }
  31.  
  32.  
  33.  
  34. // create a file called my_script.js and put it in a folder called "js" inside your theme
  35. // put the following in my_script.js. (dont put this in functions.php)
  36.  
  37. jQuery(document).ready(function($) {
  38.  
  39. // do all your rcarousel javascript here
  40. $( "#carousel" ).rcarousel({auto: {enabled: true}});
  41.  
  42. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement