Changeset 1384857
- Timestamp:
- 04/02/2016 06:58:37 AM (10 years ago)
- Location:
- display-categories-widget/trunk
- Files:
-
- 2 edited
-
display_categories_widget.php (modified) (6 diffs)
-
readme.txt (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
display-categories-widget/trunk/display_categories_widget.php
r1369783 r1384857 24 24 $category = $instance['category']; 25 25 $dcw_limit = $instance['dcw_limit']; 26 $dcw_option_name = $instance['dcw_option_name']; 27 if($dcw_option_name=="") $dcw_option_name="Select A Category"; 26 28 $dcw_exclude = $instance['dcw_exclude']; 27 29 $dcw_depth = $instance['dcw_depth']; … … 37 39 $cat_options[] = '<option value="BLANK">Select one...</option>'; 38 40 foreach ($categories as $cat) { 39 $selected = $category === $cat->cat_ID? ' selected="selected"' : '';41 $selected = ($category == $cat->cat_ID) ? ' selected="selected"' : ''; 40 42 $cat_options[] = '<option value="' . $cat->cat_ID .'"' . $selected . '>' . $cat->name . '</option>'; 41 43 } … … 54 56 </p> 55 57 <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> 56 59 <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> 57 60 <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> … … 86 89 $instance['category'] = $new_instance['category']; 87 90 $instance['dcw_limit'] = $new_instance['dcw_limit']; 91 $instance['dcw_option_name'] = $new_instance['dcw_option_name']; 88 92 $instance['dcw_exclude'] = $new_instance['dcw_exclude']; 89 93 $instance['dcw_depth'] = $new_instance['dcw_depth']; … … 106 110 $cat_id = $instance['category']; 107 111 $dcw_limit = $instance['dcw_limit']; 112 $dcw_option_name = $instance['dcw_option_name']; 108 113 $dcw_exclude = $instance['dcw_exclude']; 109 114 $dcw_depth = $instance['dcw_depth']; … … 139 144 <form action="<?php bloginfo('url'); ?>" method="get"> 140 145 <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); ?> 142 147 <script type="text/javascript"> 143 148 <!-- -
display-categories-widget/trunk/readme.txt
r1369783 r1384857 2 2 Contributors: iteamweb 3 3 Donate link: 4 Tags: categories, widget, list categories, hide categories, select categories, level, Post categories, Categories display, categories widget 4 Tags: categories, widget, list categories, hide categories, select categories, level, Post categories, Categories display, categories widget, categories drop down 5 5 Requires at least: 3.3 6 6 Tested up to: 4.4.2 7 Stable tag: 2.0. 17 Stable tag: 2.0.2 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 17 17 Features: 18 18 1. Limit number of categories that appears. 19 19 20 2. Exclude categories from display. 21 20 22 3. Restrict levels of categories that can be shown. 23 21 24 4. Display categories as list or dropdown. 25 22 26 5. Hide categories that does not have any posts. 27 23 28 6. Display/Hide number of posts available in categories. 24 29 … … 55 60 56 61 == Changelog == 62 63 = 2.0.2 = 64 * Bug fixes 65 * Added a label for dropdown non-selection case 57 66 58 67 = 2.0.1 =
Note: See TracChangeset
for help on using the changeset viewer.