Code standards and better action names
This commit is contained in:
parent
0dad12537b
commit
bfebd204ee
|
@ -189,11 +189,11 @@ class WC_Widget_Products extends WC_Widget {
|
|||
if ( ( $products = $this->get_products( $args, $instance ) ) && $products->have_posts() ) {
|
||||
$this->widget_start( $args, $instance );
|
||||
|
||||
echo apply_filters( 'woocommerce_before_widget_product_list', '<ul class="product_list_widget">' );
|
||||
echo wp_kses_post( apply_filters( 'woocommerce_before_widget_product_list', '<ul class="product_list_widget">' ) );
|
||||
|
||||
$template_args = array(
|
||||
'widget_id' => $args['widget_id'],
|
||||
'show_rating' => true
|
||||
'widget_id' => $args['widget_id'],
|
||||
'show_rating' => true,
|
||||
);
|
||||
|
||||
while ( $products->have_posts() ) {
|
||||
|
@ -201,7 +201,7 @@ class WC_Widget_Products extends WC_Widget {
|
|||
wc_get_template( 'content-widget-product.php', $template_args );
|
||||
}
|
||||
|
||||
echo apply_filters( 'woocommerce_after_widget_product_list', '</ul>' );
|
||||
echo wp_kses_post( apply_filters( 'woocommerce_after_widget_product_list', '</ul>' ) );
|
||||
|
||||
$this->widget_end( $args );
|
||||
}
|
||||
|
|
|
@ -89,10 +89,10 @@ class WC_Widget_Recently_Viewed extends WC_Widget {
|
|||
|
||||
$this->widget_start( $args, $instance );
|
||||
|
||||
echo apply_filters( 'woocommerce_before_widget_product_list', '<ul class="product_list_widget">' );
|
||||
echo wp_kses_post( apply_filters( 'woocommerce_before_widget_product_list', '<ul class="product_list_widget">' ) );
|
||||
|
||||
$template_args = array(
|
||||
'widget_id' => $args['widget_id']
|
||||
'widget_id' => $args['widget_id'],
|
||||
);
|
||||
|
||||
while ( $r->have_posts() ) {
|
||||
|
@ -100,7 +100,7 @@ class WC_Widget_Recently_Viewed extends WC_Widget {
|
|||
wc_get_template( 'content-widget-product.php', $template_args );
|
||||
}
|
||||
|
||||
echo apply_filters( 'woocommerce_after_widget_product_list', '</ul>' );
|
||||
echo wp_kses_post( apply_filters( 'woocommerce_after_widget_product_list', '</ul>' ) );
|
||||
|
||||
$this->widget_end( $args );
|
||||
}
|
||||
|
|
|
@ -79,11 +79,11 @@ class WC_Widget_Top_Rated_Products extends WC_Widget {
|
|||
|
||||
$this->widget_start( $args, $instance );
|
||||
|
||||
echo apply_filters( 'woocommerce_before_widget_product_list', '<ul class="product_list_widget">' );
|
||||
echo wp_kses_post( apply_filters( 'woocommerce_before_widget_product_list', '<ul class="product_list_widget">' ) );
|
||||
|
||||
$template_args = array(
|
||||
'widget_id' => $args['widget_id'],
|
||||
'show_rating' => true
|
||||
'widget_id' => $args['widget_id'],
|
||||
'show_rating' => true,
|
||||
);
|
||||
|
||||
while ( $r->have_posts() ) {
|
||||
|
@ -91,7 +91,7 @@ class WC_Widget_Top_Rated_Products extends WC_Widget {
|
|||
wc_get_template( 'content-widget-product.php', $template_args );
|
||||
}
|
||||
|
||||
echo apply_filters( 'woocommerce_after_widget_product_list', '</ul>' );
|
||||
echo wp_kses_post( apply_filters( 'woocommerce_after_widget_product_list', '</ul>' ) );
|
||||
|
||||
$this->widget_end( $args );
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<?php
|
||||
/**
|
||||
* The template for displaying product widget entries
|
||||
* The template for displaying product widget entries.
|
||||
*
|
||||
* This template can be overridden by copying it to yourtheme/woocommerce/content-widget-product.php.
|
||||
* HOWEVER, on occasion WooCommerce will need to update template files and you
|
||||
* (the theme developer) will need to copy the new files to your theme to
|
||||
|
@ -14,26 +15,25 @@
|
|||
* @version 3.3.0
|
||||
*/
|
||||
|
||||
// Exit if accessed directly
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
global $product; ?>
|
||||
|
||||
global $product;
|
||||
?>
|
||||
<li>
|
||||
<?php
|
||||
// Let 3rd parties customize the product list item.
|
||||
do_action( 'woocommerce_after_widget_product_item_starts', $args ); ?>
|
||||
<a href="<?php echo esc_url( $product->get_permalink() ); ?>">
|
||||
<?php do_action( 'woocommerce_widget_product_item_start', $args ); ?>
|
||||
|
||||
<a href="<?php echo esc_url( $product->get_permalink() ); ?>">
|
||||
<?php echo $product->get_image(); ?>
|
||||
<span class="product-title"><?php echo $product->get_name(); ?></span>
|
||||
</a>
|
||||
<span class="product-title"><?php echo $product->get_name(); ?></span>
|
||||
</a>
|
||||
|
||||
<?php if ( ! empty( $show_rating ) ) : ?>
|
||||
<?php echo wc_get_rating_html( $product->get_average_rating() ); ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php echo $product->get_price_html(); ?>
|
||||
<?php
|
||||
// Let 3rd parties customize the product list item.
|
||||
do_action( 'woocommerce_before_widget_product_item_ends', $args ); ?>
|
||||
|
||||
<?php do_action( 'woocommerce_widget_product_item_end', $args ); ?>
|
||||
</li>
|
||||
|
|
Loading…
Reference in New Issue