Created
December 8, 2017 04:27
-
-
Save anonymous/b79a8cbbe7ee28a6c065076f15b5c0c8 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
function yummy_pro_before_product_end() { | |
$options = yummy_pro_get_theme_options(); | |
echo '</div><!-- end .wrapper --><div class="page-decoration"> | |
<img src="PLACE YOUR IMAGE URL HERE" alt="'. esc_attr__( 'Decoration', 'yummy-pro' ) .'"> | |
<img src="PLACE YOUR IMAGE URL HERE" alt="'. esc_attr__( 'Decoration', 'yummy-pro' ) .'"> | |
</div><!-- .page-decoration --> | |
</section><!-- end #shop-product -->'; | |
if ( ! is_singular() && $options['shop_pagination_type'] == 'infinite-scroll' ) { | |
echo'<i class="fa fa-spinner fa-spin woo-loader"></i>'; | |
} | |
} | |
function yummy_pro_primary_content_start() { | |
remove_action( 'pre_get_posts', 'yummy_pro_filter_get_posts' ); | |
$options = yummy_pro_get_theme_options(); | |
$args = array( | |
'posts_per_page' => -1, | |
'no_found_rows' => 1, | |
'post_status' => 'publish', | |
'post_type' => 'product', | |
'orderby' => 'date', | |
'order' => 'DESC', | |
'meta_query' => WC()->query->get_meta_query(), | |
'post__in' => array_merge( array( 0 ), wc_get_product_ids_on_sale() ) | |
); | |
$woo_posts = get_posts( $args ); | |
if ( empty( $woo_posts ) ) { | |
return ; | |
} | |
$product_term = array(); | |
$i = 1; | |
foreach ( $woo_posts as $post ) : | |
$terms = get_the_terms( $post->ID, 'product_cat' ); | |
$terms = ! empty( $terms ) ? $terms : array(); | |
foreach ( $terms as $term ) : | |
if ( ! in_array( $term->slug, array_column( $product_term, 'slug' ) ) ) : | |
$thumbnail_id = get_woocommerce_term_meta( $term->term_id, 'thumbnail_id', true ); | |
$image = wp_get_attachment_url( $thumbnail_id ); | |
$product_term[$i]['name'] = $term->name; | |
$product_term[$i]['slug'] = $term->slug; | |
$product_term[$i]['img_url'] = ! empty( $image ) ? $image : get_template_directory_uri() . '/assets/uploads/restaurant.png'; | |
endif; | |
$i ++; | |
endforeach; | |
endforeach; | |
if ( empty( $product_term ) ) { | |
return ; | |
} | |
?> | |
<section id="shop-category" class="col-2"> | |
<div class="wrapper"> | |
<div class="special-offer" style="background-image:url('<?php echo get_template_directory_uri(); ?>/assets/uploads/special-offer.png')"> | |
<div class="overlay"></div> | |
<?php if( ! empty( $options['sale_title'] ) || ! empty( $options['sale_sub_title'] ) ) : ?> | |
<div class="offer-content"> | |
<?php if ( ! empty( $options['sale_title'] ) ) : ?> | |
<span class="price"><?php echo esc_html( $options['sale_title'] ); ?></span> | |
<?php endif; | |
if ( ! empty( $options['sale_sub_title'] ) ) : ?> | |
<h3 class="color-white"><?php echo esc_html( $options['sale_sub_title'] ); ?></h3> | |
<?php endif; ?> | |
</div><!--.offer-content--> | |
<?php endif; ?> | |
</div><!--.special-offer--> | |
</div><!-- .wrapper --> | |
<div class="wrapper"> | |
<div class="column-wrapper"> | |
<div class="cart-collection"> | |
<div class="cart-images clear"> | |
<ul> | |
<?php foreach ( $product_term as $term ) : ?> | |
<li class="shop-sale-cat"> | |
<a href="#" data-slug="<?php echo esc_attr( $term['slug'] ); ?>"> | |
<?php if ( ! empty( $term['img_url'] ) ) : ?> | |
<img src="<?php echo esc_url( $term['img_url'] ); ?>" alt="<?php echo esc_attr( $term['name'] ); ?>"> | |
<?php endif; | |
echo esc_html( $term['name'] ); ?> | |
</a> | |
</li> | |
<?php endforeach; ?> | |
</ul> | |
</div><!--.cart-images--> | |
</div><!--.cart-collection--> | |
</div><!--.column-wrapper--> | |
<div class="column-wrapper"> | |
<div id="shop-sale-slide"> | |
<div class="shop-slider" data-slick='{"slidesToShow": 2, "slidesToScroll": 1, "infinite": false, "speed": 600, "dots": false, "arrows":false, "autoplay": true, "fade": false, "dragable":false,}'> | |
<?php foreach ( $woo_posts as $post ) : | |
$post_id = $post->ID; | |
if ( has_post_thumbnail( $post_id ) ) { | |
$img_array = wp_get_attachment_image_src( get_post_thumbnail_id( $post_id ), 'shop_single' ); | |
} else { | |
$img_array[0] = get_template_directory_uri() . '/assets/uploads/no-featured-image-600x600.jpg'; | |
} | |
$post_term = get_the_terms( $post_id, 'product_cat' ); | |
?> | |
<div class="slider-item | |
<?php foreach ( $post_term as $term ) : | |
echo esc_attr( $term->slug ) . ' '; | |
endforeach; ?>"> | |
<div class="featured-product-image" style="background-image:url('<?php echo esc_url( $img_array[0] ); ?>')"> | |
<div class="shop-details"> | |
<div class="pull-left"> | |
<h5 class="color-white"><a href="<?php the_permalink( $post_id ) ?>"><?php echo esc_html( $post->post_title ); ?></a></h5> | |
<div class="pull-left meta-links"> | |
<?php $tags = get_the_terms( $post_id, 'product_tag' ); | |
if ( ! empty( $tags ) ) : | |
foreach ( $tags as $tag ) : ?> | |
<span><a href="<?php echo esc_url( get_term_link( $tag->term_id ) ); ?>"><?php echo esc_html( $tag->name ); ?></a></span> | |
<?php endforeach; | |
endif; ?> | |
</div><!-- .meta-links --> | |
</div><!-- .pull-left --> | |
<div class="pull-right"> | |
<span class="price"> | |
<?php | |
$product = new WC_Product( $post_id ); | |
echo $product->get_price_html(); | |
?> | |
</span><!-- .price --> | |
</div><!--.pull-right--> | |
</div><!-- .shop-details --> | |
</div><!-- .featured-product-image --> | |
</div><!-- .slider-item --> | |
<?php endforeach; ?> | |
</div><!--.shop-slider--> | |
</div><!-- .tab-pane --> | |
</div> | |
</div> | |
<div class="page-decoration"> | |
<img src="PLACE YOUR IMAGE URL HERE" alt="<?php esc_attr_e( 'Decoration', 'yummy-pro' ); ?>"> | |
<img src="PLACE YOUR IMAGE URL HERE" alt="<?php esc_attr_e( 'Decoration', 'yummy-pro' ); ?>"> | |
</div><!-- .page-decoration --> | |
</section> | |
<?php } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment