Widget tweaks
This commit is contained in:
parent
34032965a8
commit
1f2f6f7f8e
|
@ -74,11 +74,11 @@ class WooCommerce_Widget_Best_Sellers extends WP_Widget {
|
|||
<?php echo $before_widget; ?>
|
||||
<?php if ( $title ) echo $before_title . $title . $after_title; ?>
|
||||
<ul class="product_list_widget">
|
||||
<?php while ($r->have_posts()) : $r->the_post(); $_product = &new woocommerce_product(get_the_ID()); ?>
|
||||
<?php while ($r->have_posts()) : $r->the_post(); global $product; ?>
|
||||
<li><a href="<?php the_permalink() ?>" title="<?php echo esc_attr(get_the_title() ? get_the_title() : get_the_ID()); ?>">
|
||||
<?php if (has_post_thumbnail()) the_post_thumbnail('shop_thumbnail'); else echo '<img src="'.$woocommerce->plugin_url().'/assets/images/placeholder.png" alt="Placeholder" width="'.$woocommerce->get_image_size('shop_thumbnail_image_width').'" height="'.$woocommerce->get_image_size('shop_thumbnail_image_height').'" />'; ?>
|
||||
<?php if ( get_the_title() ) the_title(); else the_ID(); ?>
|
||||
</a> <?php echo $_product->get_price_html(); ?></li>
|
||||
</a> <?php echo $product->get_price_html(); ?></li>
|
||||
<?php endwhile; ?>
|
||||
</ul>
|
||||
<?php echo $after_widget; ?>
|
||||
|
|
|
@ -66,12 +66,12 @@ class WooCommerce_Widget_Featured_Products extends WP_Widget {
|
|||
<?php echo $before_widget; ?>
|
||||
<?php if ( $title ) echo $before_title . $title . $after_title; ?>
|
||||
<ul class="product_list_widget">
|
||||
<?php foreach ($featured_posts as $r) : $_product = &new woocommerce_product( $r->ID ); ?>
|
||||
<?php foreach ($featured_posts as $r) : $r->the_post(); global $product; ?>
|
||||
|
||||
<li><a href="<?php echo esc_url( get_permalink( $r->ID ) ); ?>" title="<?php echo esc_attr($r->post_title ? $r->post_title : $r->ID); ?>">
|
||||
<?php echo $_product->get_image(); ?>
|
||||
<?php echo $product->get_image(); ?>
|
||||
<?php if ( $r->post_title ) echo get_the_title( $r->ID ); else echo $r->ID; ?>
|
||||
</a> <?php echo $_product->get_price_html(); ?></li>
|
||||
</a> <?php echo $product->get_price_html(); ?></li>
|
||||
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
|
|
|
@ -107,11 +107,11 @@ class WooCommerce_Widget_On_Sale extends WP_Widget {
|
|||
<?php echo $before_widget; ?>
|
||||
<?php if ( $title ) echo $before_title . $title . $after_title; ?>
|
||||
<ul class="product_list_widget">
|
||||
<?php while ($r->have_posts()) : $r->the_post(); $_product = &new woocommerce_product(get_the_ID()); ?>
|
||||
<?php while ($r->have_posts()) : $r->the_post(); global $product; ?>
|
||||
<li><a href="<?php the_permalink() ?>" title="<?php echo esc_attr(get_the_title() ? get_the_title() : get_the_ID()); ?>">
|
||||
<?php if (has_post_thumbnail()) the_post_thumbnail('shop_thumbnail'); else echo '<img src="'.$woocommerce->plugin_url().'/assets/images/placeholder.png" alt="Placeholder" width="'.$woocommerce->get_image_size('shop_thumbnail_image_width').'" height="'.$woocommerce->get_image_size('shop_thumbnail_image_height').'" />'; ?>
|
||||
<?php if ( get_the_title() ) the_title(); else the_ID(); ?>
|
||||
</a> <?php echo $_product->get_price_html(); ?></li>
|
||||
</a> <?php echo $product->get_price_html(); ?></li>
|
||||
<?php endwhile; ?>
|
||||
</ul>
|
||||
<?php echo $after_widget; ?>
|
||||
|
|
|
@ -81,11 +81,11 @@ class WooCommerce_Widget_Recent_Products extends WP_Widget {
|
|||
<?php echo $before_widget; ?>
|
||||
<?php if ( $title ) echo $before_title . $title . $after_title; ?>
|
||||
<ul class="product_list_widget">
|
||||
<?php while ($r->have_posts()) : $r->the_post(); $_product = &new woocommerce_product(get_the_ID()); ?>
|
||||
<?php while ($r->have_posts()) : $r->the_post(); global $product; ?>
|
||||
<li><a href="<?php the_permalink() ?>" title="<?php echo esc_attr(get_the_title() ? get_the_title() : get_the_ID()); ?>">
|
||||
<?php if (has_post_thumbnail()) the_post_thumbnail('shop_thumbnail'); else echo '<img src="'.$woocommerce->plugin_url().'/assets/images/placeholder.png" alt="Placeholder" width="'.$woocommerce->get_image_size('shop_thumbnail_image_width').'" height="'.$woocommerce->get_image_size('shop_thumbnail_image_height').'" />'; ?>
|
||||
<?php if ( get_the_title() ) the_title(); else the_ID(); ?>
|
||||
</a> <?php echo $_product->get_price_html(); ?></li>
|
||||
</a> <?php echo $product->get_price_html(); ?></li>
|
||||
<?php endwhile; ?>
|
||||
</ul>
|
||||
<?php echo $after_widget; ?>
|
||||
|
|
|
@ -70,11 +70,11 @@ class WooCommerce_Widget_Recently_Viewed extends WP_Widget {
|
|||
<?php echo $before_widget; ?>
|
||||
<?php if ( $title ) echo $before_title . $title . $after_title; ?>
|
||||
<ul class="product_list_widget">
|
||||
<?php while ($r->have_posts()) : $r->the_post(); $_product = &new woocommerce_product(get_the_ID()); ?>
|
||||
<?php while ($r->have_posts()) : $r->the_post(); global $product; ?>
|
||||
<li><a href="<?php the_permalink() ?>" title="<?php echo esc_attr(get_the_title() ? get_the_title() : get_the_ID()); ?>">
|
||||
<?php if (has_post_thumbnail()) the_post_thumbnail('shop_thumbnail'); else echo '<img src="'.$woocommerce->plugin_url().'/assets/images/placeholder.png" alt="Placeholder" width="'.$woocommerce->get_image_size('shop_thumbnail_image_width').'" height="'.$woocommerce->get_image_size('shop_thumbnail_image_height').'" />'; ?>
|
||||
<?php if ( get_the_title() ) the_title(); else the_ID(); ?>
|
||||
</a> <?php echo $_product->get_price_html(); ?></li>
|
||||
</a> <?php echo $product->get_price_html(); ?></li>
|
||||
<?php endwhile; ?>
|
||||
</ul>
|
||||
<?php echo $after_widget; ?>
|
||||
|
@ -130,7 +130,7 @@ class WooCommerce_Widget_Recently_Viewed extends WP_Widget {
|
|||
add_action( 'woocommerce_before_single_product', 'woocommerce_track_product_view', 10);
|
||||
|
||||
function woocommerce_track_product_view() {
|
||||
global $post, $_product;
|
||||
global $post, $product;
|
||||
|
||||
if (!isset($_SESSION['viewed_products']) || !is_array($_SESSION['viewed_products'])) $_SESSION['viewed_products'] = array();
|
||||
|
||||
|
|
|
@ -70,12 +70,12 @@ class WooCommerce_Widget_Top_Rated_Products extends WP_Widget {
|
|||
if ( $title ) echo $before_title . $title . $after_title;
|
||||
?>
|
||||
<ul class="product_list_widget">
|
||||
<?php while ($top_rated_posts->have_posts()) : $top_rated_posts->the_post(); $_product = &new woocommerce_product( $top_rated_posts->post->ID );
|
||||
<?php while ($top_rated_posts->have_posts()) : $top_rated_posts->the_post(); global $product;
|
||||
?>
|
||||
<li><a href="<?php echo esc_url( get_permalink( $top_rated_posts->post->ID ) ); ?>" title="<?php echo esc_attr($top_rated_posts->post->post_title ? $top_rated_posts->post->post_title : $top_rated_posts->post->ID); ?>">
|
||||
<?php echo $_product->get_image(); ?>
|
||||
<?php echo $product->get_image(); ?>
|
||||
<?php if ( $top_rated_posts->post->post_title ) echo get_the_title( $top_rated_posts->post->ID ); else echo $top_rated_posts->post->ID; ?>
|
||||
</a> <?php echo $_product->get_rating_html('sidebar'); ?><?php echo $_product->get_price_html(); ?></li>
|
||||
</a> <?php echo $product->get_rating_html('sidebar'); ?><?php echo $product->get_price_html(); ?></li>
|
||||
|
||||
<?php endwhile; ?>
|
||||
</ul>
|
||||
|
|
Loading…
Reference in New Issue