recent-products.php
67 lines
| 1 | <?php |
| 2 | |
| 3 | if ( ! defined( 'ABSPATH' ) ) { |
| 4 | exit; // Exit if accessed directly |
| 5 | } |
| 6 | |
| 7 | global $post, $product; |
| 8 | |
| 9 | // Ensure visibility |
| 10 | if ( empty( $product ) || ! $product->is_visible() ) { |
| 11 | return; |
| 12 | } |
| 13 | |
| 14 | $cat_count = get_the_terms( $post->ID, 'product_cat' ); |
| 15 | $cat_count = is_array( $cat_count ) ? count( $cat_count ) : 0; |
| 16 | |
| 17 | $tag_count = get_the_terms( $post->ID, 'product_tag' ); |
| 18 | $tag_count = is_array( $tag_count ) ? count( $tag_count ) : 0; |
| 19 | ?> |
| 20 | |
| 21 | <div <?php post_class(); ?>> |
| 22 | <?php |
| 23 | |
| 24 | woocommerce_template_loop_product_link_open(); |
| 25 | |
| 26 | if ( auxin_is_true( $display_sale_badge ) ) { |
| 27 | woocommerce_show_product_loop_sale_flash(); |
| 28 | } |
| 29 | |
| 30 | if ( auxin_is_true( $show_media ) ) { |
| 31 | echo auxin_kses( $the_media ); |
| 32 | } |
| 33 | |
| 34 | if ( auxin_is_true( $display_title ) ) { |
| 35 | woocommerce_template_loop_product_title(); |
| 36 | } |
| 37 | |
| 38 | ?> |
| 39 | <div class="loop-meta-wrapper"> |
| 40 | <div class="product_meta"> |
| 41 | <?php |
| 42 | $rating_count = $product->get_rating_count(); |
| 43 | $average = $product->get_average_rating(); |
| 44 | |
| 45 | if ( $rating_count > 0 ) { |
| 46 | echo wc_get_rating_html( $average, $rating_count ); |
| 47 | } |
| 48 | |
| 49 | if ( auxin_is_true( $display_categories ) && $cat_count > 0 ) { |
| 50 | echo wc_get_product_category_list( $product->get_id(), ', ', '<em class="auxshp-meta-terms">', '</em>' ); |
| 51 | } ?> |
| 52 | </div> |
| 53 | </div> |
| 54 | <?php |
| 55 | if ( auxin_is_true( $display_price ) ) { |
| 56 | woocommerce_template_loop_price(); |
| 57 | } |
| 58 | |
| 59 | woocommerce_template_loop_product_link_close(); |
| 60 | |
| 61 | if ( auxin_is_true( $display_button ) ) { |
| 62 | woocommerce_template_loop_add_to_cart(); |
| 63 | } |
| 64 | |
| 65 | ?> |
| 66 | </div> |
| 67 |