Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php } elseif (is_shop() || is_product_category()) {
- // creo un array con nombre de variable para cada categoria:
- // $ropa = get_term_by('slug', 'ropa', 'product_cat');
- // $ropa_array = (array)$ropa;
- // $ropa_array_id = $ropa_array['term_id'];
- $cat_productos = get_terms('product_cat', 'hide_empty=0');
- foreach ( $cat_productos as $term ) {
- ${$term->slug} = get_term_by('slug', $term->slug, 'product_cat');
- ${$term->slug.'_array'} = (array)${$term->slug};
- ${$term->slug.'_array_id'} =${$term->slug.'_array'}['term_id'];
- };
- // luego genero unos argumentos para cada bloque de nombres que quiero separar
- $args = array(
- 'taxonomy' => 'product_cat',
- 'orderby' => 'name',
- 'show_count' => true,
- 'pad_counts' => false,
- 'hierarchical' => true,
- 'title_li' => '',
- 'hide_empty' => 0,
- 'show_option_all' => 'Ver todo',
- 'exclude' => array( $ropa_array_id, $seda_array_id )
- );
- $args_seda = array(
- 'taxonomy' => 'product_cat',
- 'orderby' => 'name',
- 'show_count' => true,
- 'pad_counts' => false,
- 'hierarchical' => true,
- 'title_li' => '',
- 'hide_empty' => 0,
- 'exclude' => array( $ediciones_array_id, $objetos_array_id, $ropa_array_id )
- );
- $args_ropa = array(
- 'taxonomy' => 'product_cat',
- 'orderby' => 'name',
- 'show_count' => true,
- 'pad_counts' => false,
- 'hierarchical' => true,
- 'title_li' => '',
- 'hide_empty' => 0,
- 'exclude' => array( $ediciones_array_id, $objetos_array_id, $seda_array_id )
- );
- ?>
- <div class="desplegable-cat">
- <a class="" role="button" data-toggle="collapse" href="#collapseExample" aria-expanded="false" aria-controls="collapseExample">
- Categorías
- </a>
- <div class="collapse" id="collapseExample">
- <ul class="catego">
- <?php wp_list_categories( $args ); ?>
- <?php wp_list_categories( $args_seda ); ?>
- <?php wp_list_categories( $args_ropa ); ?>
- </ul>
- </div>
- </div>
- <?php } ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement