No Description

content-widget-product.php 1.5KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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. if ( ! defined( 'ABSPATH' ) ) {
  17. exit;
  18. }
  19. global $product;
  20. if ( ! is_a( $product, 'WC_Product' ) ) {
  21. return;
  22. }
  23. ?>
  24. <li>
  25. <?php do_action( 'woocommerce_widget_product_item_start', $args ); ?>
  26. <a href="<?php echo esc_url( $product->get_permalink() ); ?>">
  27. <?php echo $product->get_image(); // PHPCS:Ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
  28. <span class="product-title"><?php echo wp_kses_post( $product->get_name() ); ?></span>
  29. </a>
  30. <?php if ( ! empty( $show_rating ) ) : ?>
  31. <?php echo wc_get_rating_html( $product->get_average_rating() ); // PHPCS:Ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
  32. <?php endif; ?>
  33. <?php echo $product->get_price_html(); // PHPCS:Ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
  34. <?php do_action( 'woocommerce_widget_product_item_end', $args ); ?>
  35. </li>