Created
August 15, 2017 15:25
-
-
Save accessomnath/1afcba74a7a6bb6b089527358ef17491 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| $meta_query = WC()->query->get_meta_query(); | |
| $tax_query = WC()->query->get_tax_query(); | |
| $tax_query[] = array( | |
| 'taxonomy' => 'product_visibility', | |
| 'field' => 'name', | |
| 'terms' => 'featured', | |
| 'operator' => 'IN', | |
| ); | |
| $args = array( | |
| 'post_type' => 'product', | |
| 'post_status' => 'publish', | |
| 'meta_query' => $meta_query, | |
| 'tax_query' => $tax_query, | |
| ); | |
| $loop = new WP_Query($args); | |
| while ($loop->have_posts()) : $loop->the_post(); | |
| global $product; ?> | |
| <div class="best-sell-product"> | |
| <div class="best-product-img"> | |
| <?php | |
| if (has_post_thumbnail($loop->post->ID)) | |
| echo get_the_post_thumbnail($loop->post->ID, 'shop_catalog'); | |
| else | |
| echo '<a href="#"><img src="' . woocommerce_placeholder_img_src() . '" alt="product"/></a>'; | |
| ?> | |
| <!-- <a href="#"><img--> | |
| <!-- src="--> | |
| <?php //bloginfo('template_url'); ?><!--/img/product/best-product-1.png"--> | |
| <!-- alt="product"></a>--> | |
| </div> | |
| <div class="best-product-content"> | |
| <h2><a href="#"><?php the_title(); ?></a></h2> | |
| <h3><?php | |
| echo $product->get_price_html(); | |
| woocommerce_template_loop_add_to_cart($loop->post, $product); | |
| ?></h3> | |
| </div> | |
| </div> | |
| <?php | |
| endwhile; | |
| wp_reset_query(); | |
| ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment