diff --git a/admin/tabs/basics.php b/admin/tabs/basics.php index 5f09e627..baddec3f 100644 --- a/admin/tabs/basics.php +++ b/admin/tabs/basics.php @@ -93,6 +93,7 @@ function add_mega_menu_items( $items, $args ) { $options_item = esc_html( 'None ', 'wpt' ) . $term_name; $options_item = ""; $options_item = ""; //REmoved Default None Value + $selecteds = isset( $data['terms'][$term_key] ) ? $data['terms'][$term_key] : false; if( is_array( $term_obj ) && count( $term_obj ) > 0 ){ $selected_term_ids = isset( $data['terms'][$term_key] ) ? $data['terms'][$term_key] : false; foreach ( $term_obj as $terms ) { @@ -121,6 +122,38 @@ function add_mega_menu_items( $items, $args ) { } if( !empty( $options_item ) ){ + +/***************************************** + + + $defaults = array( + 'show_option_all' => '', + 'show_option_none' => '', + 'orderby' => 'name', + 'order' => 'ASC', + 'show_count' => 0, + 'hide_empty' => 1, + 'child_of' => 0, + 'exclude' => '', + 'echo' => 1, + 'selected' => $selecteds, + 'hierarchical' => 1,//0, // 1 for Tree format, and 0 for plane format + 'name' => "basics[data][terms][$term_key]",//'cat', + 'id' => 'wpt_term_' . $term_key,//'', + 'class' => "wpt_select2 ua_select wpt_query_terms ua_query_terms_" . $term_key,//'postform', + 'depth' => 0, + 'tab_index' => 0, + 'taxonomy' => $term_key,//'category', + 'hide_if_empty' => false, + 'option_none_value' => -1, + 'value_field' => 'term_id', + 'multiple' => true, + 'data-key' => $term_key, + ); + //Helping from https://wordpress.stackexchange.com/questions/216070/wp-dropdown-categories-with-multiple-select/253403 + wpt_wp_dropdown_categories( $defaults ); + +//***************************************/ ?> ` element should have the HTML5 'required' attribute. + * Default false. + * } + * @return string HTML dropdown list of categories. + */ +function wpt_wp_dropdown_categories( $args = '', $get_taxonomy = false ) { + $defaults = array( + 'show_option_all' => '', + 'show_option_none' => '', + 'orderby' => 'id', + 'order' => 'ASC', + 'show_count' => 0, + 'hide_empty' => 1, + 'child_of' => 0, + 'exclude' => '', + 'echo' => 1, + 'selected' => 0, + 'hierarchical' => 0, + 'name' => 'cat', + 'id' => '', + 'class' => 'postform', + 'depth' => 0, + 'tab_index' => 0, + 'taxonomy' => 'category', + 'hide_if_empty' => false, + 'option_none_value' => -1, + 'value_field' => 'term_id', + 'multiple' => false, + 'data-key' => false, + ); + + $defaults['selected'] = ( is_category() ) ? get_query_var( 'cat' ) : 0; + + // Back compat. + if ( isset( $args['type'] ) && 'link' === $args['type'] ) { + _deprecated_argument( + __FUNCTION__, + '3.0.0', + sprintf( + /* translators: 1: "type => link", 2: "taxonomy => link_category" */ + __( '%1$s is deprecated. Use %2$s instead.' ), + 'type => link', + 'taxonomy => link_category' + ) + ); + $args['taxonomy'] = 'link_category'; + } + + // Parse incoming $args into an array and merge it with $defaults. + $parsed_args = wp_parse_args( $args, $defaults ); + + $option_none_value = $parsed_args['option_none_value']; + + if ( ! isset( $parsed_args['pad_counts'] ) && $parsed_args['show_count'] && $parsed_args['hierarchical'] ) { + $parsed_args['pad_counts'] = true; + } + + $tab_index = $parsed_args['tab_index']; + + $tab_index_attribute = ''; + if ( (int) $tab_index > 0 ) { + $tab_index_attribute = " tabindex=\"$tab_index\""; + } + + // Avoid clashes with the 'name' param of get_terms(). + $get_terms_args = $parsed_args; + unset( $get_terms_args['name'] ); + $categories = get_terms( $get_terms_args ); + + if( is_array( $get_taxonomy ) && ! empty( $get_taxonomy ) ){ + $categories = $get_taxonomy; + } + + $name = esc_attr( $parsed_args['name'] ); + $class = esc_attr( $parsed_args['class'] ); + $id = $parsed_args['id'] ? esc_attr( $parsed_args['id'] ) : $name; + $multiple = $parsed_args['multiple'] ? 'multiple' : ''; + + $data_key = $parsed_args['data-key'] ? esc_attr( $parsed_args['data-key'] ) : ''; + + if ( ! $parsed_args['hide_if_empty'] || ! empty( $categories ) ) { + $output = "\n"; + } + + /** + * Filters the taxonomy drop-down output. + * + * @since 2.1.0 + * + * @param string $output HTML output. + * @param array $parsed_args Arguments used to build the drop-down. + */ + $output = apply_filters( 'wp_dropdown_cats', $output, $parsed_args ); + + if ( $parsed_args['echo'] ) { + echo $output; + } + + return $output; +} + if( !function_exists( 'wpt_paginate_links' ) ){ diff --git a/includes/shortcode.php b/includes/shortcode.php index 26ce61c3..160301bb 100644 --- a/includes/shortcode.php +++ b/includes/shortcode.php @@ -1039,7 +1039,7 @@ function wpt_texonomy_search_generator( $texonomy_keyword, $temp_number , $searc /** * Need for get_texonomy and get_terms */ - $texonomy_sarch_args = array('hide_empty' => true,'orderby' => 'count','order' => 'DESC'); + $texonomy_sarch_args = array('hide_empty' => true,'orderby' => 'count','order' => 'ASC'); $taxonomy_details = get_taxonomy( $texonomy_keyword ); @@ -1053,34 +1053,94 @@ function wpt_texonomy_search_generator( $texonomy_keyword, $temp_number , $searc $multiple_selectable = apply_filters( 'wpto_is_multiple_selectable', true, $texonomy_keyword, $temp_number ) ? 'multiple' : ''; - $html .= ""; + + + $html .= wpt_wp_dropdown_categories( $defaults, $customized_texonomy_boj ); + + +// #### $html .= ""; +// } +// +// $html .= wpt_wp_dropdown_categories( $defaults ); +// }else{ +// foreach( $texonomy_boj as $item ){ +// $name = $item->name; +// $customized_texonomy_boj[$name] = $item; +// +// } +// $customized_texonomy_boj = wpt_sorting_array( $customized_texonomy_boj, $config_value['sort_searchbox_filter'] ); +// foreach( $customized_texonomy_boj as $item ){ +// #### $html .= ""; // ({$item->count}) +// } +// #### $html .= ""; +// +// //multiple $multiple_selectable +// +// $html .= wpt_wp_dropdown_categories( $defaults ); +// } +// +// +// +// } +// diff --git a/readme.txt b/readme.txt index c8543c2b..4285037d 100644 --- a/readme.txt +++ b/readme.txt @@ -156,6 +156,11 @@ You can easily show specific category products. While creating new table click o == Changelog == += 2.8.3 = + * Fixed: Taxonomy hierarchy added. + * Fixed: Short Message showing in order issue has fixed. + * Fixed: Bug Fix. + = 2.8.2 = * Fixed: Responsive Tab Issue fixed. diff --git a/woo-product-table.php b/woo-product-table.php index 73a58ae9..4f7f2ac2 100644 --- a/woo-product-table.php +++ b/woo-product-table.php @@ -7,7 +7,7 @@ * Author URI: https://codecanyon.net/user/codeastrology * Tags: woocommerce product,woocommerce product table, product table * - * Version: 2.8.2 + * Version: 2.8.3 * Requires at least: 4.0.0 * Tested up to: 5.6 * WC requires at least: 3.0.0 @@ -30,7 +30,7 @@ } if( !defined( 'WPT_DEV_VERSION' ) ){ - define( 'WPT_DEV_VERSION', '2.8.2.3' ); + define( 'WPT_DEV_VERSION', '2.8.3.5' ); } if( !defined( 'WPT_CAPABILITY' ) ){