Plugin Directory

Changeset 1384857


Ignore:
Timestamp:
04/02/2016 06:58:37 AM (10 years ago)
Author:
iteamweb
Message:

Bug fixes and non selection label update

Location:
display-categories-widget/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • display-categories-widget/trunk/display_categories_widget.php

    r1369783 r1384857  
    2424    $category = $instance['category'];
    2525    $dcw_limit = $instance['dcw_limit'];
     26    $dcw_option_name = $instance['dcw_option_name'];
     27    if($dcw_option_name=="") $dcw_option_name="Select A Category";
    2628    $dcw_exclude = $instance['dcw_exclude'];
    2729    $dcw_depth = $instance['dcw_depth'];
     
    3739        $cat_options[] = '<option value="BLANK">Select one...</option>';
    3840        foreach ($categories as $cat) {
    39             $selected = $category === $cat->cat_ID ? ' selected="selected"' : '';
     41            $selected = ($category == $cat->cat_ID) ? ' selected="selected"' : '';
    4042            $cat_options[] = '<option value="' . $cat->cat_ID .'"' . $selected . '>' . $cat->name . '</option>';
    4143        }
     
    5456            </p>
    5557<p><label for="<?php echo $this->get_field_id('dcw_limit'); ?>"><?php _e('Limit (optional):'); ?> <input class="widefat" id="<?php echo $this->get_field_id('dcw_limit'); ?>" name="<?php echo $this->get_field_name('dcw_limit'); ?>" type="text" value="<?php echo esc_attr($dcw_limit); ?>" /></label></p>
     58<p><label for="<?php echo $this->get_field_id('dcw_option_name'); ?>"><?php _e('Label no-selection (optional):'); ?> <input class="widefat" id="<?php echo $this->get_field_id('dcw_option_name'); ?>" name="<?php echo $this->get_field_name('dcw_option_name'); ?>" type="text" value="<?php echo esc_attr($dcw_option_name); ?>" /></label></p>
    5659<p><label for="<?php echo $this->get_field_id('dcw_exclude'); ?>"><?php _e('Category ID\'s to exclude (optional):'); ?> <input class="widefat" id="<?php echo $this->get_field_id('dcw_exclude'); ?>" name="<?php echo $this->get_field_name('dcw_exclude'); ?>" type="text" value="<?php echo esc_attr($dcw_exclude); ?>" /></label><br><?php _e('<small>Ex: 26,32,54 (comma-separated list of category ids)</small>'); ?></p>
    5760<p><label for="<?php echo $this->get_field_id('dcw_depth'); ?>"><?php _e('Levels in the hierarchy to show (optional):'); ?> <input class="widefat" id="<?php echo $this->get_field_id('dcw_depth'); ?>" name="<?php echo $this->get_field_name('dcw_depth'); ?>" type="text" value="<?php echo esc_attr($dcw_depth); ?>" /></label><br><?php _e('<small>0 - All Categories and child Categories (Default).<br>
     
    8689    $instance['category'] = $new_instance['category'];
    8790    $instance['dcw_limit'] = $new_instance['dcw_limit'];
     91    $instance['dcw_option_name'] = $new_instance['dcw_option_name'];
    8892    $instance['dcw_exclude'] = $new_instance['dcw_exclude'];
    8993    $instance['dcw_depth'] = $new_instance['dcw_depth'];
     
    106110    $cat_id = $instance['category'];
    107111    $dcw_limit = $instance['dcw_limit'];
     112    $dcw_option_name = $instance['dcw_option_name'];   
    108113    $dcw_exclude = $instance['dcw_exclude'];
    109114    $dcw_depth = $instance['dcw_depth'];
     
    139144  <form action="<?php bloginfo('url'); ?>" method="get">
    140145  <div>
    141   <?php wp_dropdown_categories('orderby=name&hierarchical=1&show_count='.$showcount_value.'&child_of='.$cat_id.'&hide_empty='.$display_empty_categories.'&title_li=&number='.$dcw_limit.'&exclude='.$dcw_exclude.'&depth='.$dcw_depth); ?>
     146  <?php wp_dropdown_categories('show_option_none='.$dcw_option_name.'&orderby=name&hierarchical=1&show_count='.$showcount_value.'&child_of='.$cat_id.'&hide_empty='.$display_empty_categories.'&title_li=&number='.$dcw_limit.'&exclude='.$dcw_exclude.'&depth='.$dcw_depth); ?>
    142147  <script type="text/javascript">
    143148    <!--
  • display-categories-widget/trunk/readme.txt

    r1369783 r1384857  
    22Contributors: iteamweb
    33Donate link:
    4 Tags: categories, widget, list categories, hide categories, select categories, level, Post categories, Categories display, categories widget
     4Tags: categories, widget, list categories, hide categories, select categories, level, Post categories, Categories display, categories widget, categories drop down
    55Requires at least: 3.3
    66Tested up to: 4.4.2
    7 Stable tag: 2.0.1
     7Stable tag: 2.0.2
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    1717Features:
    18181. Limit number of categories that appears.
     19
    19202. Exclude categories from display.
     21
    20223. Restrict levels of categories that can be shown.
     23
    21244. Display categories as list or dropdown.
     25
    22265. Hide categories that does not have any posts.
     27
    23286. Display/Hide number of posts available in categories.
    2429
     
    5560
    5661== Changelog ==
     62
     63= 2.0.2 =
     64* Bug fixes
     65* Added a label for dropdown non-selection case
    5766
    5867= 2.0.1 =
Note: See TracChangeset for help on using the changeset viewer.