• Skip to main content
  • Skip to primary sidebar
  • Skip to footer

[oik] plugins.com

WordPress plugins and themes

  • 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 82 of 82
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 {
    $args = $atts;
    unset( $args['format']);
    $posts = bw_get_posts( $args );
  }  
  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

Primary Sidebar

Information

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

Recent plugin updates

oik-fields v1.55.1
oik-fields v1.55.1 oik-fields v1.55.1 has been tested with WordPress 7.1. ...
oik v4.16.0
oik v4.16.0 Upgrade to oik v4.16.0 for many accessibility (a11y) improvements for both the front end and admin areas, plus a security fix. ...
oik-fields v1.55.0
oik-fields v1.55.0 Upgrade to oik-fields v1.55.0 for accessibility improvements to the featured image virtual field. ...
oik-css v2.4.0
oik-css v2.4.0 Upgrade to oik-css v2.4.0 for accessibility improvements for Low Color Contrast errors. ...
oik-unloader v0.4.0
oik-unloader v0.4.0 Update to oik-unloader v0.4.0 for improved accessibility of the active-plugins shortcode. Tested with WordPress 6.9 and PHP 8.4 ...

Footer

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: oikplug@oik-plugins.com

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-2026. All rights reserved.


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

WordPress version: 7.1.2

Gutenberg version: 24.0.0

PHP version: 8.2.35