From b0a0b6005f4668d4a5fb2fbda2e1905d4392353f Mon Sep 17 00:00:00 2001 From: Daniel Langer Date: Mon, 23 Jan 2012 23:22:07 -0500 Subject: [PATCH] Fixes control-hiding --- readme.txt | 9 ++++++++- simpleslider.php | 50 +++++++++++++++++++++++++----------------------- 2 files changed, 34 insertions(+), 25 deletions(-) diff --git a/readme.txt b/readme.txt index d4a1785..dd9f0f0 100644 --- a/readme.txt +++ b/readme.txt @@ -111,6 +111,10 @@ link decorations are all styled by the theme that's in use. * Added auto-advancing slideshow support * Controls are now their own CSS classes (thanks to ThomasBuxo) += 1.3 = +* Sizing (image vs. DIV) bug fixed (thanks to kitchin) +* Supports exclude filter to match Gallery shortcode and hiding of controls (thanks to robcolburn) + == Upgrade Notice == = 1.0 = @@ -120,4 +124,7 @@ Initial upload to Wordpress.org. This version allows the use of all Cycle translations. Adds support for internationalization. Upgrades the version of Cycle Lite used to properly hide non-displayed elements and their links. = 1.2 = -This version supports auto-advancing slideshows, as well as improved internals and more customizable CSS. \ No newline at end of file +This version supports auto-advancing slideshows, as well as improved internals and more customizable CSS. + += 1.3 = +In this version, the size of the containing div is much more accurate, removing problems some users had with too much whitespace. Support for excluding certain images, as well as hiding the controls, is added. \ No newline at end of file diff --git a/simpleslider.php b/simpleslider.php index f541876..a122888 100644 --- a/simpleslider.php +++ b/simpleslider.php @@ -94,17 +94,18 @@ function sss_handle_shortcode( $attrs ) { 'image&post_parent=' . get_the_ID() . '&orderby=menu_order&order=ASC' ); - + print_r(shortcode_atts( $defaults, + $attrs)); // Don't load anything or start processing if there are no // images to display. if( empty($images) ) return ''; - if( !empty($attrs['exclude']) ) { - $exclude = explode(',', $attrs['exclude']); - foreach ($exclude as $image_id) { - unset($images[trim($image_id)]); + if( ! empty( $attrs[ 'exclude' ] ) ) { + $exclude = explode(',', $attrs[ 'exclude' ]); + foreach ( $exclude as $image_id ) { + unset( $images[ trim( $image_id ) ] ); } } @@ -152,29 +153,30 @@ function sss_handle_shortcode( $attrs ) { } $resp .= "\n"; + + if ( true == $show_counter ) + $image_counter = '
1/' . count($images) . '
'; + else + $image_counter = ''; + + $resp .= '
'; - // Controls - if ( true == $show_controls ) { - $resp .= "\n".'
'; + if ( true == $show_controls ) $resp .= "◄ " . - __( 'Prev.', 'simple_slideshow' ) . " "; - - if ( true == $show_counter ) { - $resp .= ' 
1/' . count($images) . '
'; - } - - $resp .= "  " . + __( 'Prev.', 'simple_slideshow' ) . " " . + " "; + + $resp .= ${image_counter}; + + if ( true == $show_controls) + $resp .= "  " . __( 'Next', 'simple_slideshow' ) . " ►"; - $resp .= '
'; - - } elseif ( true == $show_counter ) { - $resp .= "\n".'
1/' . count($images) . - '
'; - } + + $resp .= "
\n"; // JavaScript