Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- add_action('parse_query', 'devise_product_attribute_sorting_query_2');
- function devise_product_attribute_sorting_query_2( $query ) {
- global $pagenow;
- $taxonomy = 'pa_design';
- $q_vars = &$query->query_vars;
- if ( $pagenow == 'edit.php' && isset($q_vars['post_type']) && $q_vars['post_type'] == 'product' && isset($q_vars[$taxonomy]) && is_numeric($q_vars[$taxonomy]) && $q_vars[$taxonomy] != 0 ) {
- $term = get_term_by('id', $q_vars[$taxonomy], $taxonomy);
- $q_vars[$taxonomy] = $term->slug;
- }
- }
- function devise_filter_design_form() {
- $selected = isset($_GET['pa_design']) ? $_GET['pa_design'] : '';
- wp_dropdown_categories( array(
- 'taxonomy' => 'pa_design',
- 'name' => 'pa_design',
- 'show_option_none' => 'Фильтр по цвету',
- 'show_count' => false,
- 'hide_empty' => true,
- 'selected' => $selected
- )
- );
- }
- add_action( 'restrict_manage_posts', 'devise_filter_design_form', 25 );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement