Plugin Directory

Changeset 1018335


Ignore:
Timestamp:
11/02/2014 12:53:56 PM (11 years ago)
Author:
Shellbot
Message:

Added option to show/hide image captions

Location:
easy-image-display/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • easy-image-display/trunk/readme.txt

    r994143 r1018335  
    2020Current features include:
    2121
     22* Show or hide image captions
    2223* Newest, oldest, random and custom sorting options
    2324* Include/exclude images based on ID
     
    124125== Changelog ==
    125126
     127= 1.2.2 =
     128* Added option to show/hide captions
     129
    126130= 1.2.1 =
    127131* Fixed incompatibility with other plugins affecting the [gallery] shortcode
     
    152156== Upgrade Notice ==
    153157
     158= 1.2.2 =
     159* New feature! Show/hide image captions.
     160
    154161= 1.2.1 =
    155162* Fixes incompatibility with other plugins affecting the [gallery] shortcode
  • easy-image-display/trunk/sb-easy-image-display.php

    r994142 r1018335  
    44Plugin URI: http://shellbotics.com/wordpress-plugins/easy-image-display/
    55Description: An easy way to display random or latest images on your site.
    6 Version: 1.2.1
     6Version: 1.2.2
    77Author: Shellbot
    88Author URI: http://shellbotics.com
     
    6666                });         
    6767            </script>';
     68    }
     69   
     70    function public_css( $gallery_id = '' ) {
     71        echo '<style type="text/css">'
     72            . '#' . $gallery_id . ' .gallery-caption { display: none !important; }'
     73            . '</style>';
    6874    }
    6975
     
    8692            'filter' => 'only',
    8793            'ids' => '',
     94            'captions' => 'on',
    8895        ), $args ) );
    8996
     
    98105            'filter' => $filter,
    99106            'ids' => $ids,
     107            'captions' => $captions,
    100108        );
    101109
     
    117125            'filter' => 'only',
    118126            'ids' => '',
     127            'captions' => 'on',
    119128        ), $args ) );
    120129
     
    129138            'filter' => $filter,
    130139            'ids' => $ids,
     140            'captions' => $captions,
    131141        );
    132142
     
    148158            'filter' => 'only',
    149159            'ids' => '',
     160            'captions' => 'on',
    150161        ), $args ) );
    151162
     
    160171            'filter' => $filter,
    161172            'ids' => $ids,
     173            'captions' => $captions,
    162174        );
    163175
     
    168180    /* Construct query and return array of images ------------------------------- */
    169181
    170     function sb_get_easy_image( $args, $src = '' ) {  
    171 
     182    function sb_get_easy_image( $args, $src = '' ) {
     183       
    172184        $query = array (
    173185            'post_type' => 'attachment',
     
    243255                $ids .= $attachment->ID . ', ';
    244256            }
    245             return do_shortcode( '[sb_gallery columns="' . $args['columns'] . '" ids="' . $ids . '" size="' . strtolower( $args['size'] ) . '" link="' . strtolower( $args['link'] ) . '" url="' . strtolower( $args['url'] ) . '"]' );
     257
     258            return do_shortcode( '[sb_gallery columns="' . $args['columns'] . '" ids="' . $ids . '" size="' . strtolower( $args['size'] ) . '" link="' . strtolower( $args['link'] ) . '" url="' . strtolower( $args['url'] ) . ' captions="' . strtolower( $args['captions'] ) . '"]' );
    246259
    247260        } else {
     
    355368            $this->public_js( $gallery_id );
    356369        }
     370       
     371        if( strtolower( $attr['captions'] ) == 'off' ) {
     372            $this->public_css( $gallery_id );
     373        }
    357374
    358375        return $output;
  • easy-image-display/trunk/sb-easy-image-widget.php

    r994142 r1018335  
    22/**
    33 * Widget Name: Easy Image Display
    4  * Version: 1.2.1
     4 * Version: 1.2.2
    55 */
    66
     
    4848        $instance['filter']    = $new_instance['filter'];
    4949        $instance['ids']    = $new_instance['ids'];
     50        $instance['captions'] = $new_instance['captions'];
    5051
    5152        return $instance;
     
    9091                'Exclude',
    9192            ),
     93            'captions' => array(
     94                'On',
     95                'Off',
     96            ),
    9297        );
    9398
     
    113118                'filter' => 'Only',
    114119                'ids' => '',
     120                'captions' => 'on',
    115121            );
    116122
     
    140146                        <option value="<?php echo $order; ?>" <?php if ( $order == $instance['order'] ) { echo 'selected="selected"'; } ?>>
    141147                            <?php echo $order; ?>
     148                        </option>
     149                    <?php
     150                    }
     151                    ?>
     152                </select>
     153            </p>
     154           
     155            <!-- Captions -->
     156            <p>
     157                <label for="<?php echo $this->get_field_id( 'captions' ); ?>"><?php esc_html_e( 'Captions:', 'shellbotics' ); ?></label>
     158                <select id="<?php echo $this->get_field_id( 'captions' ); ?>" name="<?php echo $this->get_field_name( 'captions' ); ?>" >
     159                    <?php
     160                    foreach ( $params['captions'] as $caption ) {
     161                    ?>
     162                        <option value="<?php echo $caption; ?>" <?php if ( $caption == $instance['captions'] ) { echo 'selected="selected"'; } ?>>
     163                            <?php echo $caption; ?>
    142164                        </option>
    143165                    <?php
     
    240262            'filter'  => $instance['filter'],
    241263            'ids'     => $instance['ids'],
     264            'captions'=> $instance['captions'],
    242265        );
    243266
Note: See TracChangeset for help on using the changeset viewer.