Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Code in functions.php
- function nivo_slider_rrf () {
- wp_enqueue_script('jquery');
- wp_enqueue_script( 'nivo_main_file', get_template_directory_uri() . '/js/jquery.nivo.slider.pack.js', array('jquery') );
- wp_enqueue_script( 'nivo_active_file', get_template_directory_uri() . '/js/nivo-slider-active.js', array('jquery') );
- wp_enqueue_style( 'nivo-default-theme', get_template_directory_uri() . '/nivo-slider/themes/default/default.css' );
- wp_enqueue_style( 'nivo-light-theme', get_template_directory_uri() . '/nivo-slider/themes/light/light.css' );
- wp_enqueue_style( 'nivo-dark-theme', get_template_directory_uri() . '/nivo-slider/themes/dark/dark.css' );
- wp_enqueue_style( 'nivo-bar-theme', get_template_directory_uri() . '/nivo-slider/themes/bar/bar.css' );
- wp_enqueue_style( 'nivo-main-css', get_template_directory_uri() . '/nivo-slider/nivo-slider.css' );
- }
- add_action( 'wp_enqueue_scripts', 'nivo_slider_rrf' );
- function nivo_slider_loop ($atts, $content = null){
- extract ( shortcode_atts ( array (
- 'theme' => 'defult',
- ), $atts, 'slider') );
- return '<div class="slider-wrapper theme-'.$theme.'"><div id="slider" class="nivoSlider">' . do_shortcode($content) . '</div></div>';
- }
- add_shortcode ('slider', 'nivo_slider_loop');
- function nivo_slides_loop ($atts){
- extract ( shortcode_atts ( array (
- 'content' => 'null',
- 'image' => 'null',
- 'title' => 'default',
- 'link' => 'http://',
- ), $atts, 'slides') );
- return '<a href="'.$link.'"><img src="'.$image.'" data-thumb="'.$image.'" alt="" title="'.$title.'" /></a>';
- }
- add_shortcode ('slides', 'nivo_slides_loop');
- Usage
- [slider theme="light"][slides image="http://lorempixel.com/600/350/nature/" title="Slider Caption" link="http://wordpress.org"] [slides image="http://placehold.it/600x350" title="Slider Caption" link="http://google.com"][/slider]
Add Comment
Please, Sign In to add comment