Advertisement
hmbashar

How can I display sorting system with my custom query?

Feb 24th, 2018
584
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.67 KB | None | 0 0
  1. <div class="mproduct-area fix">
  2.  
  3.     <?php
  4.  
  5.         $mproduct = new WP_Query(array(
  6.                 'post_type'     => 'product',
  7.                 'posts_per_page'=> 10,
  8.                 'tax_query' => array(
  9.                     array(
  10.                         'taxonomy' => 'product_cat',
  11.                         'field' => 'slug',
  12.                         'terms' => array( 'combinations' ),
  13.                         'operator' => 'NOT IN'
  14.                         )
  15.                     )                      
  16.         ));
  17.         if($mproduct->have_posts()) : while($mproduct->have_posts()) : $mproduct->the_post(); ?>
  18.  
  19.  
  20.         <!--Single Product for Mobile Page-->
  21.         <div class="msingle-product fix">
  22.             <div class="msingle-product-image">
  23.                 <a href="<?php the_permalink(); ?>">
  24.                 <?php if(has_post_thumbnail( get_the_ID())){
  25.  
  26.                      echo get_the_post_thumbnail( get_the_ID(), 'com_product_img' );
  27.                 } else {
  28.                     echo '<img src="' . woocommerce_placeholder_img_src() . '" alt="Placeholder" />';
  29.                 }
  30.                 ?></a>
  31.             </div>
  32.             <div class="mproduct-price">
  33.                 <h2><strong>Price : </strong> <?php echo $product->get_price_html(); ?></h2>                        
  34.             </div>
  35.             <div class="mproduct-name">
  36.                 <h2><a href="<?php the_permalink(); ?>" title="<?php echo esc_attr( $product->get_title() ) ?>"><?php echo esc_attr( $product->get_title() ) ?></a></h2>
  37.             </div>
  38.             <div class="mproduct-add-to-cart">
  39.                 <?php woocommerce_template_loop_add_to_cart(); ?>  
  40.                 <!-- Modal -->
  41.                 <div class="modal fade" id="myModal" role="dialog" aria-labelledby="myModalLabel">
  42.                   <div class="modal-dialog" role="document">
  43.                     <div class="modal-content">
  44.                       <div class="modal-header">
  45.                         <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
  46.                         <h4 class="modal-title" id="myModalLabel"><?php echo esc_attr( $product->get_title() ) ?></h4>
  47.                       </div>
  48.                       <div class="modal-body">
  49.  
  50.                         <div class="msingle-product-image product_img_model">
  51.                             <a href="<?php the_permalink(); ?>">
  52.                             <?php if(has_post_thumbnail( get_the_ID())){
  53.  
  54.                                  echo get_the_post_thumbnail( get_the_ID(), 'com_product_img' );
  55.                             } else {
  56.                                 echo '<img src="' . woocommerce_placeholder_img_src() . '" alt="Placeholder" />';
  57.                             }
  58.                             ?></a>
  59.                         </div>
  60.  
  61.                         <div class="mproduct-price">
  62.                             <h2><strong>Price : </strong> <?php echo $product->get_price_html(); ?></h2>                        
  63.                         </div>
  64.                         <div class="product_variable_list">
  65.  
  66.  
  67.                         <?php wc_get_template_part('content', 'single-product'); ?>
  68.  
  69.  
  70.                         </div>
  71.                       </div>
  72.                       <div class="modal-footer">
  73.                         <button type="button" class="btn btn-default" data-dismiss="modal">Continue Shipping</button>
  74.                       </div>
  75.                     </div>
  76.                   </div>
  77.                 </div>
  78.             </div>                  
  79.         </div><!--/ Single Product for Mobile Page-->
  80.  
  81.  
  82.     <?php endwhile; endif;?>
  83.  
  84. </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement