global $post; $default_archive_names = default_archive_names(); $multiple_settings = get_multiple_settings(); $archive_names = get_archive_names(); do_action('product_listing_begin'); ?> <article id="product_listing" <?php post_class('al_product responsive'); ?> > <?php do_action('before_product_listing_entry', $post, $archive_names); ?> <div class="entry-content"> <?php $before_archive = content_product_adder_archive_before(); $archive_template = get_product_listing_template(); $taxonomy_name = apply_filters('current_product_catalog_taxonomy', 'al_product-cat'); if (!is_tax() && !is_search()) { if ($before_archive != '<div class="entry-summary"></div>') { echo $before_archive; } if ($multiple_settings['product_listing_cats'] == 'on') { if ($multiple_settings['cat_template'] != 'template') { $product_subcategories = wp_list_categories('show_option_none=No_cat&echo=0&title_li=&taxonomy=' . $taxonomy_name . '&parent=0'); if (!strpos($product_subcategories, 'No_cat')) { echo '<div class="product-subcategories">' . $product_subcategories . '</div>'; } } else { $show_categories = do_shortcode('[show_categories parent="0"]'); if (!empty($show_categories)) {
/** * Shows categories on product listing for custom templates usage * * @return string */ function ic_product_listing_categories() { ob_start(); $multiple_settings = get_multiple_settings(); $archive_template = get_product_listing_template(); $taxonomy_name = apply_filters('current_product_catalog_taxonomy', 'al_product-cat'); if (!is_tax() && !is_search()) { $before_archive = content_product_adder_archive_before(); if ($before_archive != '<div class="entry-summary"></div>') { echo $before_archive; } if ($multiple_settings['product_listing_cats'] == 'on' || $multiple_settings['product_listing_cats'] == 'cats_only') { if ($multiple_settings['cat_template'] != 'template') { $product_subcategories = wp_list_categories('show_option_none = No_cat&echo = 0&title_li = &taxonomy = ' . $taxonomy_name . '&parent = 0'); if (!strpos($product_subcategories, 'No_cat')) { do_action('before_product_listing_category_list'); echo '<div class = "product-subcategories">' . $product_subcategories . '</div>'; } } else { $show_categories = do_shortcode('[show_categories parent = "0" shortcode_query = "no"]'); if (!empty($show_categories)) { do_action('before_product_listing_category_list'); echo $show_categories; if ($archive_template != 'list' && !is_ic_only_main_cats()) { echo '<hr>'; } } } } } else { if (is_tax()) { $term = get_queried_object()->term_id; if (is_ic_category_image_enabled()) { $term_img = get_product_category_image_id($term); echo wp_get_attachment_image($term_img, apply_filters('product_cat_image_size', 'large'), false, array('class' => 'product-category-image')); } $term_description = term_description(); if (!empty($term_description)) { echo '<div class = "taxonomy-description">' . $term_description . '</div>'; } if ($multiple_settings['category_top_cats'] == 'on' || $multiple_settings['category_top_cats'] == 'only_subcategories') { if ($multiple_settings['cat_template'] != 'template') { $product_subcategories = wp_list_categories('show_option_none = No_cat&echo = 0&title_li = &taxonomy = ' . $taxonomy_name . '&child_of = ' . $term); if (!strpos($product_subcategories, 'No_cat')) { ?> <div class="product-subcategories"> <?php do_action('before_category_subcategories'); echo $product_subcategories; ?> </div> <?php } } else { $show_categories = do_shortcode('[show_categories parent = ' . get_queried_object_id() . ' shortcode_query = no]'); if (!empty($show_categories)) { do_action('before_category_subcategories'); echo $show_categories; if ($archive_template != 'list' && !is_ic_only_main_cats()) { echo '<hr>'; } } } } } } return ob_get_clean(); }
/** * Generates product listing categories * * @param type $archive_template * @param type $multiple_settings */ function ic_product_listing_categories($archive_template, $multiple_settings) { $taxonomy_name = apply_filters('current_product_catalog_taxonomy', 'al_product-cat'); if (!is_tax() && !is_search()) { $before_archive = content_product_adder_archive_before(); if ($before_archive != '<div class="entry-summary"></div>') { echo $before_archive; } if ($multiple_settings['product_listing_cats'] == 'on' || $multiple_settings['product_listing_cats'] == 'cats_only') { if ($multiple_settings['cat_template'] != 'template') { $product_subcategories = wp_list_categories('show_option_none=No_cat&echo=0&title_li=&taxonomy=' . $taxonomy_name . '&parent=0'); if (!strpos($product_subcategories, 'No_cat')) { do_action('before_product_listing_category_list'); echo '<div class="product-subcategories">' . $product_subcategories . '</div>'; } } else { $show_categories = do_shortcode('[show_categories parent="0" shortcode_query="no"]'); if (!empty($show_categories)) { do_action('before_product_listing_category_list'); echo $show_categories; if ($archive_template != 'list' && !is_ic_only_main_cats()) { echo '<hr>'; } } } } } else { if (is_tax()) { $term = get_queried_object()->term_id; do_action('product_category_page_start', $term); if ($multiple_settings['category_top_cats'] == 'on' || $multiple_settings['category_top_cats'] == 'only_subcategories') { if ($multiple_settings['cat_template'] != 'template') { $product_subcategories = wp_list_categories('show_option_none=No_cat&echo=0&title_li=&taxonomy=' . $taxonomy_name . '&child_of=' . $term); if (!strpos($product_subcategories, 'No_cat')) { ?> <div class="product-subcategories"> <?php do_action('before_category_subcategories'); echo $product_subcategories; ?> </div> <?php } } else { $show_categories = do_shortcode('[show_categories parent=' . get_queried_object_id() . ' shortcode_query=no]'); if (!empty($show_categories)) { do_action('before_category_subcategories'); echo $show_categories; if ($archive_template != 'list' && !is_ic_only_main_cats()) { echo '<hr>'; } } } } } } }