daily pastebin goal
13%
SHARE
TWEET

Untitled

a guest Jul 13th, 2018 75 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.  
  3.     // параметры по умолчанию
  4.     $args = array(
  5.         'numberposts' => -1,
  6.         'category'    => 0,
  7.         'orderby'     => 'date',
  8.         'order'       => 'DESC',
  9.         'include'     => array(),
  10.         'exclude'     => array(),
  11.         'meta_key'    => '',
  12.         'meta_value'  =>'',
  13.         'post_type'   => 'product',
  14.         'suppress_filters' => true, // подавление работы фильтров изменения SQL запроса
  15.     );
  16.  
  17.     $posts = get_posts( $args );
  18.  
  19.     foreach($posts as $post) {
  20.         setup_postdata($post);
  21.  
  22.         global $woocommerce;
  23.         $currency = get_woocommerce_currency_symbol();
  24.         $price = $currency . get_post_meta( get_the_ID(), '_regular_price', true);
  25.         $sale = get_post_meta( get_the_ID(), '_sale_price', true);
  26.     ?>
  27.  
  28.     <!-- Product -->
  29.     <div class="product">
  30.         <div class="product_image">
  31.  
  32.             <img src="<?php the_post_thumbnail_url('full'); ?>" alt="">
  33.         </div>
  34.  
  35.             <?php
  36.                 $terms = get_the_terms( get_the_ID(), 'product_tag', ' ',', ', '');
  37.  
  38.                 foreach($terms as $term) { ?>
  39.                     <div class="product_extra product_<?php echo $term->name; ?>">
  40.                         <a href="<? echo get_term_link($term);?>"><?php echo $term->name; ?></a>
  41.                     </div>
  42.                 <?php }//endforeach  ?>
  43.  
  44.  
  45.  
  46.         <div class="product_content">
  47.             <div class="product_title"><a href="<?php echo the_permalink(); ?>"> <?php the_title(); ?></a></div>
  48.             <div class="product_price"><?php echo $price; ?></div>
  49.         </div>
  50.     </div>
  51.  
  52. <?php   } //endforeach
  53.     wp_reset_postdata(); // сброс
  54.  ?>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top