[oik] plugins.com

WordPress plugins and themes

  • Home
  • About
    • lazy shortcodes
    • smart shortcodes
    • oik base plugin
      • oik – donate
      • oik PayPal buttons
      • oik installation
      • oik Button Shortcode button
      • oik changelog
      • oik FAQ
      • oik plugins on SVN
      • oik plugins on GitHub
  • Plugins
    • oik base plugin
    • FREE oik plugins
    • WordPress plugins
    • Premium oik plugins
    • Bespoke oik plugins
  • Shortcodes
    • Shortcode examples
  • Blocks
    • Block examples
  • APIs
    • ALL action and filter hooks
  • Blog

bw_nivo_slider() – Implement the [nivo] shortcode to display a Nivo slider for attachments or other post types

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 types

The 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 shortcode

Source

File name: oik-nivo-slider/nivo.php
Lines:

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

Published: November 16, 2012 | Last updated: December 18, 2017

Information

Function name: bw_nivo_slider
Plugin ref: oik-nivo-slider – jQuery nivo slider
Version: 1.16.0
Sourcefile: nivo.php
File ref: nivo.php
API type: shortcode
Deprecated?: No
API Letters: B,N,S

Recent plugin updates

oik-themes v1.4.0 

Update to oik-themes v1.4.0 to support Full Site Editing (FSE) themes. FSE themes, which are currently experimental, deliver block based templates and template parts.

 ...
oik-clone v2.0.1 oik-clone v2.0.1 contains a fix for a 500 internal server error being produced when cloning content with certain taxonomy terms. ...
SB Chart block v0.1.1 

Update to SB Chart block v0.1.1 for improved enqueing of the chart.js Javascript and better colours in the Gutenberg palette.

 ...
Slog v1.3.1 

Update to Slog v1.3.1 for a new Driver tab and improved display of charts grouping Elapsed times.

 ...
SB-Chart-Block v0.0.8 SB-Chart-Block v0.0.8, a WordPress single block plugin, supports 4 different chart types; Line, Bar, Horizontal bar and Pie. ...

Plugins

  • All Plugins
  • oik base plugin
  • FREE oik plugins
  • WordPress plugins
  • Premium oik plugins

Themes

  • FREE themes
  • Bespoke themes
  • Premium themes

Blocks

  • All Blocks
  • Block examples
  • About Blocks

Shortcodes

  • All Shortcodes
  • Shortcode examples
  • About Shortcodes

Reference

  • About APIs
  • All APIs
  • All Classes
  • All Files
  • All Hooks

Support

  • Contact
  • Cookies policy
  • Get API key
  • Privacy
  • Request support
  • Sitemap
  • Stay informed
  • Terms and Conditions
oik-plugins
Email: [email protected]

Weight shipping plugins

Find out which cart weight shipping plugin you need for your WooCommerce site.
Which cart weight based plugin do I need?

Site:  www.oik-plugins.com
© Copyright oik-plugins 2011-2021. All rights reserved.


Website designed and developed by Herb Miller of Bobbing Wide
Proudly powered by WordPress and oik-plugins