Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // put this in your theme's functons.php
- // load javascript and stylesheets only on the front end.
- if(!is_admin()){
- add_action('wp_enqueue_scripts', 'install_rcarousel_javascript');
- }
- function install_rcarousel_javascript() {
- // put the rcarousel files in a folder called "rcarousel" in your theme
- // (wp-content/themes/yourtheme/rcarousel/)
- $theme_url = get_template_directory_uri();
- // register rcarousel and all it's dependend files
- wp_register_script('rcarousel',
- $theme_url . '/rcarousel/widget/lib/jquery.ui.rcarousel.min.js',
- array('jquery','jquery-ui-core','jquery-ui-widget'));
- // enqueue all rcarousel javascript files
- wp_enqueue_script('rcarousel');
- // register your own script and put it in a folder js in your theme
- // this way we dont need inline javascript
- wp_register_script('rcarousel_my_script', $theme_url.'/js/my_script.js', array('rcarousel'));
- wp_enqueue_script('rcarousel_my_script');
- // register the stylesheet for rcarousel
- wp_register_style('rcarousel_style', $theme_url .'/rcarousel/widget/css/rcarousel.css');
- // enqueue the stylesheet for rcarousel
- wp_enqueue_style('rcarousel_style');
- }
- // create a file called my_script.js and put it in a folder called "js" inside your theme
- // put the following in my_script.js. (dont put this in functions.php)
- jQuery(document).ready(function($) {
- // do all your rcarousel javascript here
- $( "#carousel" ).rcarousel({auto: {enabled: true}});
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement