Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // параметры по умолчанию
- $args = array(
- 'numberposts' => -1,
- 'category' => 0,
- 'orderby' => 'date',
- 'order' => 'DESC',
- 'include' => array(),
- 'exclude' => array(),
- 'meta_key' => '',
- 'meta_value' =>'',
- 'post_type' => 'product',
- 'suppress_filters' => true, // подавление работы фильтров изменения SQL запроса
- );
- $posts = get_posts( $args );
- foreach($posts as $post) {
- setup_postdata($post);
- global $woocommerce;
- $currency = get_woocommerce_currency_symbol();
- $price = $currency . get_post_meta( get_the_ID(), '_regular_price', true);
- $sale = get_post_meta( get_the_ID(), '_sale_price', true);
- ?>
- <!-- Product -->
- <div class="product">
- <div class="product_image">
- <img src="<?php the_post_thumbnail_url('full'); ?>" alt="">
- </div>
- <?php
- $terms = get_the_terms( get_the_ID(), 'product_tag', ' ',', ', '');
- foreach($terms as $term) { ?>
- <div class="product_extra product_<?php echo $term->name; ?>">
- <a href="<? echo get_term_link($term);?>"><?php echo $term->name; ?></a>
- </div>
- <?php }//endforeach ?>
- <div class="product_content">
- <div class="product_title"><a href="<?php echo the_permalink(); ?>"> <?php the_title(); ?></a></div>
- <div class="product_price"><?php echo $price; ?></div>
- </div>
- </div>
- <?php } //endforeach
- wp_reset_postdata(); // сброс
- ?>
Add Comment
Please, Sign In to add comment