content-widget-product.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  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. * @author WooThemes
  14. * @package WooCommerce/Templates
  15. * @version 3.3.0
  16. */
  17. if ( ! defined( 'ABSPATH' ) ) {
  18. exit;
  19. }
  20. global $product;
  21. ?>
  22. <li>
  23. <?php do_action( 'woocommerce_widget_product_item_start', $args ); ?>
  24. <a href="<?php echo esc_url( $product->get_permalink() ); ?>">
  25. <?php echo $product->get_image(); ?>
  26. <span class="product-title"><?php echo $product->get_name(); ?></span>
  27. </a>
  28. <?php if ( ! empty( $show_rating ) ) : ?>
  29. <?php echo wc_get_rating_html( $product->get_average_rating() ); ?>
  30. <?php endif; ?>
  31. <?php echo $product->get_price_html(); ?>
  32. <?php do_action( 'woocommerce_widget_product_item_end', $args ); ?>
  33. </li>