You appear to be a bot. Output may be restricted
Description
Implement the [nivo] shortcode to display a Nivo slider for attachments or other post typesThe nivo slider consists of: jQuery, the Nivo slider jQuery and something to attach nivoSlider to the div containing the images Nivo is a bit pernickety about the html you use in order to create links with captions; finally dealt with in version 1.12 with the addition of bw_format_nivo_html_captions().
Usage
$string = bw_nivo_slider( $atts );
Parameters
- $atts
- ( array ) optional – array of shortcode parameters
Returns
string the results of expanding the shortcodeSource
File name: oik-nivo-slider/nivo.phpLines:
1 to 80 of 80
function bw_nivo_slider( $atts=null ) { $atts[ 'post_type'] = bw_array_get( $atts, "post_type", "attachment" ); if ( $atts['post_type'] == "attachment" ) { $def_post_mime_type = "image"; } else { $def_post_mime_type = null; } $atts[ 'post_mime_type'] = bw_array_get( $atts, "post_mime_type", $def_post_mime_type ); $theme = bw_array_get( $atts, "theme", "default" ); $class = bw_array_get( $atts, "class", null ); $format = bw_array_get( $atts, "format", null ); if ( $format ) { $atts['link'] = bw_array_get( $atts, "link", "n" ); } else { $atts['link'] = bw_array_get( $atts, "link", "y" ); } $atts['caption'] = bw_array_get($atts, "caption", "y" ); $ribbon = bw_validate_torf( bw_array_get( $atts, "ribbon", "y" )); $atts['thumbnail'] = bw_array_get( $atts, "thumbnail", "full" ); oik_require( "shortcodes/oik-attachments.php" ); $pos = strpos( $atts['post_type'], ':' ); if ( $pos != FALSE ) { $posts = bw_get_special_post_type( $atts ); $atts['post_type'] = substr( $atts['post_type'], 0, $pos ); } else { $posts = bw_get_posts( $atts ); } if ( $posts ) { wp_enqueue_style( "nivo{$theme}", oik_url( "themes/{$theme}/{$theme}.css", "oik-nivo-slider" ) ); $version = bw_nivo_version( $theme ); wp_enqueue_style( "nivoCSS-$version", oik_url( "nivo-slider-$version.css", "oik-nivo-slider" ) ); bw_nivo_enqueue_script( $version ); $slider_id = bw_slider_id(); //e( '<script type="text/javascript">jQuery(window).load(function() { jQuery(\'#slider-'. $slider_id. '\').nivoSlider(); });</script>' ); if ( $version == "271" ) { bw_jquery( "#slider-$slider_id", "nivoSlider271", bw_jkv( get_option( 'bw_nivo_slider' ) ), true ); } else { //bw_jquery( "#slider-$slider_id", "nivoSlider", bw_jkv( get_option( 'bw_nivo_slider' ) ), true ); $options = get_option( 'bw_nivo_slider' ); // 2013/01/29 - Implemented ability to override "controlNav" with a "nav" parameter. // and "pauseTime" with a "pause" parameter $options = bw_override_options( $options, "controlNav", $atts, "nav", "bw_validate_torf" ); $options = bw_override_options( $options, "pauseTime", $atts, "pause" ); $options = bw_override_options( $options, "manualAdvance", $atts, "manual", "bw_validate_torf" ); $options = bw_override_options( $options, "controlNavThumbs", $atts, "thumbs", "bw_validate_torf" ); $options = bw_override_options( $options, "effect", $atts, "effect", "bw_filter_transition_effect" ); //bw_trace2( $options, "options" ); bw_jquery( "#slider-$slider_id", "nivoSlider", bw_jkv( $options ), true ); } if ( bw_validate_torf( $atts['link'] ) ) { $oik_nc_script = 'jquery.oik-nc-click.js'; wp_enqueue_script( 'oik-nc-click.js', oik_url( $oik_nc_script, "oik-nivo-slider" ), array( "nivo-slider-$version-js" ) ); //e( '<script type="text/javascript">jQuery(window).load(function() { jQuery(\'#slider-'. $slider_id. '\').oikNCClick(); });</script>' ); bw_jquery( "#slider-$slider_id", "oikNCClick", null, true ); } sdiv( $class ); sdiv( "slider-wrapper theme-{$theme}" ); if ( $ribbon ) sediv( "ribbon" ); //sediv( "nivoSlider-dummy" ); sdiv( "nivoSlider", "slider-$slider_id" ); $atts['slider-id'] = "slider-$slider_id"; $funcname = bw_funcname( "bw_format_nivo", $atts['post_type'] ); $count = 0; foreach ( $posts as $post ) { $atts['count'] = $count++; $funcname( $post, $atts ); } ediv(); // Now, add the formatted content if requested if ( $format ) { bw_format_nivo_html_captions( $posts, $atts ); } ediv(); ediv( $class ); bw_clear_processed_posts(); } return bw_ret(); }View on GitHub View on Trac