content-widget-product.php (1656B)
1 <?php 2 /** 3 * The template for displaying product widget entries. 4 * 5 * This template can be overridden by copying it to yourtheme/woocommerce/content-widget-product.php. 6 * HOWEVER, on occasion WooCommerce will need to update template files and you 7 * (the theme developer) will need to copy the new files to your theme to 8 * maintain compatibility. We try to do this as little as possible, but it does 9 * happen. When this occurs the version of the template file will be bumped and 10 * the readme will list any important changes. 11 * 12 * @see https://docs.woocommerce.com/document/template-structure/ 13 * @package WooCommerce\Templates 14 * @version 3.5.5 15 */ 16 17 if ( ! defined( 'ABSPATH' ) ) { 18 exit; 19 } 20 21 global $product; 22 23 if ( ! is_a( $product, 'WC_Product' ) ) { 24 return; 25 } 26 27 ?> 28 <li> 29 <?php do_action( 'woocommerce_widget_product_item_start', $args ); ?> 30 31 <a href="<?php echo esc_url( $product->get_permalink() ); ?>"> 32 <?php echo $product->get_image(); // PHPCS:Ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?> 33 34 <div class="product_list_widget_text"> 35 <span class="product-title"><?php echo wp_kses_post( $product->get_name() ); ?></span> 36 37 <?php if ( ! empty( $show_rating ) ) : ?> 38 <?php echo wc_get_rating_html( $product->get_average_rating() ); // PHPCS:Ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?> 39 <?php endif; ?> 40 41 <span><?php echo $product->get_price_html(); // PHPCS:Ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></span> 42 </div> 43 44 </a> 45 46 <?php do_action( 'woocommerce_widget_product_item_end', $args ); ?> 47 </li>