Changeset 3022975
- Timestamp:
- 01/17/2024 02:24:52 PM (2 years ago)
- Location:
- wp-categories-widget
- Files:
-
- 9 added
- 2 edited
-
tags/2.4 (added)
-
tags/2.4/assets (added)
-
tags/2.4/assets/wcw-admin.css (added)
-
tags/2.4/assets/wcw-admin.js (added)
-
tags/2.4/index.php (added)
-
tags/2.4/lib (added)
-
tags/2.4/lib/settings.php (added)
-
tags/2.4/readme.txt (added)
-
tags/2.4/wp-categories-widget.php (added)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/wp-categories-widget.php (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
wp-categories-widget/trunk/readme.txt
r2955245 r3022975 4 4 Tags: Category Widget, Posts Widget, Taxonomy Widget, Custom Widget, product categories widget 5 5 Requires at least: 5.6 6 Tested up to: 6. 37 Stable tag: 2. 36 Tested up to: 6.4.2 7 Stable tag: 2.4 8 8 Requires PHP: 7.3 9 9 License: GPLv2 or later … … 97 97 == Changelog == 98 98 99 = 2.4 = 100 * Tested with wordpress version 6.4.2 101 * Added dropdown display option 102 99 103 = 2.1 = 100 104 * Tested with wordpress version 5.8 -
wp-categories-widget/trunk/wp-categories-widget.php
r2955343 r3022975 7 7 Author URI: https://wp-experts.in 8 8 Plugin URI: https://www.wp-experts.in/products/wp-categories-widget-addon/ 9 Version: 2. 39 Version: 2.4 10 10 */ 11 11 12 /* Copyright 2018-2 3wp-categories-widget (email : [email protected])12 /* Copyright 2018-24 wp-categories-widget (email : [email protected]) 13 13 14 14 This program is free software; you can redistribute it and/or modify … … 134 134 $title = '<h2 class="widget-title">' . __( $instance['wcw_title'], 'wp-experts.in' ) . '</h2>'; 135 135 } 136 137 $widgetstyle = !empty($instance['wcw_style']) ? $instance['wcw_style'] : 'list'; 138 136 139 // add css 137 140 //do_action('wcw_style','wcw_style_func'); … … 159 162 if($excludeCat && $wcw_action_on_cat!='') 160 163 $queryargs[$wcw_action_on_cat] = $excludeCat; 161 //print_r($queryargs); 164 //print_r($queryargs); 165 166 if( $widgetstyle=='list' ) { 162 167 $categories = wp_list_categories($queryargs); 163 168 $cat_html = preg_replace( '~\((\d+)\)(?=\s*+<)~', '<span class="post-count">$1</span>', $categories ); … … 166 171 printf( '<ul class="%s">%s</ul>', $args['widget_id'],$cat_html ); 167 172 } 173 }else{ 174 175 $parent_terms = get_terms($queryargs); 176 if ( $parent_terms ) { 177 echo $title; 178 179 echo '<select class="wcwpro-list" id="'.$args['widget_id'].'" onchange="this.options[this.selectedIndex].value && (window.location = this.options[this.selectedIndex].value);">'; 180 181 if( $parent_terms ) { 182 183 foreach ( $parent_terms as $pterm ) { 184 $queryargs['parent'] = $pterm->term_id; 185 $terms = get_terms($queryargs); 186 echo '<option class="cat-item '.($terms && !$depth ? ' cat-have-child ': '').$parentcatclass.'" id="cat-item-'.$pterm->term_id.'" value="'.get_term_link( $pterm ).'" '.selected($currentterm,$pterm->term_id) .'>'. $pterm->name.'</option>'; 187 188 //Get the Child terms 189 if($terms && !$depth) { 190 foreach ( $terms as $term ) { 191 echo '<option class="child-cat-item" id="term-'.$term->term_id.'" value="' . get_term_link( $term ) . '" '.selected($currentterm,$pterm->term_id) .'>' . $term->name.'</option>'; 192 193 } 194 } 195 } 196 197 } 198 echo '</select>'; 199 200 } 201 } 168 202 169 203 } … … 189 223 $wcw_action_on_cat = ! empty( $instance['wcw_action_on_cat'] ) ? $instance['wcw_action_on_cat'] : esc_html__( '', 'wp-experts.in' ); 190 224 $wcw_hide_count = ! empty( $instance['wcw_hide_count'] ) ? $instance['wcw_hide_count'] : esc_html__( '', 'wp-experts.in' ); 225 $wcw_style = ! empty( $instance['wcw_style'] ) ? $instance['wcw_style'] : esc_html__( '', 'wp-experts.in' ); 226 191 227 ?> 192 228 <p> … … 278 314 </div> 279 315 </div> 316 317 <p><label for="<?php echo esc_attr( $this->get_field_id( 'wcw_style' ) ); ?>"><?php _e( esc_attr( 'Category Style' ) ); ?> </label> <br> 318 <input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'wcw_style' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'wcw_style' ) ); ?>" type="radio" value="list" <?php checked( $wcw_style, 'list' ); ?>> List 319 <input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'wcw_style' ) ); ?>-1" name="<?php echo esc_attr( $this->get_field_name( 'wcw_style' ) ); ?>" type="radio" value="dropdown" <?php checked( $wcw_style, 'dropdown' ); ?>> Drop Down 320 </p> 280 321 <p> 281 322 <input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'wcw_hide_count' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'wcw_hide_count' ) ); ?>" type="checkbox" value="1" <?php checked( $wcw_hide_count, 1 ); ?>> … … 353 394 $instance['wcw_action_on_cat'] = ( ! empty( $new_instance['wcw_action_on_cat'] ) ) ? $new_instance['wcw_action_on_cat'] : ''; 354 395 $instance['wcw_hide_count'] = ( ! empty( $new_instance['wcw_hide_count'] ) ) ? strip_tags( $new_instance['wcw_hide_count'] ) : ''; 396 $instance['wcw_style'] = ( ! empty( $new_instance['wcw_style'] ) ) ? strip_tags( $new_instance['wcw_style'] ) : ''; 355 397 return $instance; 356 398 }
Note: See TracChangeset
for help on using the changeset viewer.