wpgenie

Template Name: Auctions Not Paid Template

Apr 9th, 2021
613
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php /* Template Name: Auctions Not Paid Template */ ?>
  2.  
  3.  
  4.  
  5. <?php
  6.  
  7. /* WP page template that shows all auctions that are not paid for with info about winning bid, winning user and pay now button */
  8.  
  9.  
  10.  
  11. defined( 'ABSPATH' ) || exit;
  12.  
  13. get_header( 'shop' );
  14.  
  15. do_action( 'woocommerce_before_main_content' );
  16.  
  17. ?>
  18. <header class="woocommerce-products-header">
  19.     <h1 class="woocommerce-products-header__title page-title">Auctions Not Paid For</h1>   
  20.     <?php
  21.         do_action( 'woocommerce_archive_description' );
  22.     ?>
  23. </header>
  24. <?php
  25.  
  26.  
  27.     // Return sucessfully finished auctions IDs but not paid for yet.
  28.     $args = array(
  29.     'post_type'   => 'product',
  30.     'show_past_auctions' => TRUE,
  31.     'tax_query' => array(array('taxonomy' => 'product_type' , 'field' => 'slug', 'terms' => 'auction')),
  32.     'meta_query' => array(
  33.         'relation' => 'AND',
  34.             array(
  35.                 'key' => '_auction_closed',
  36.                 'value' => '2',
  37.                 'operator' => '=',             
  38.             ),  
  39.        
  40.         ),
  41.     'auction_arhive' => TRUE,
  42.     'show_past_auctions' => TRUE
  43.  
  44.     );    
  45.     $the_query  = new WP_Query( $args );
  46.  
  47.     if ( $the_query->have_posts() ) {
  48.  
  49.         do_action( 'woocommerce_before_shop_loop' );
  50.  
  51.         woocommerce_product_loop_start();
  52.        
  53.         while ( $the_query->have_posts() ) {
  54.  
  55.             $the_query->the_post();                
  56.             $auction = wc_get_product($post->ID);
  57.             do_action( 'woocommerce_shop_loop' );
  58.  
  59.         ?>
  60.         <li <?php wc_product_class( '', $product ); ?>>
  61.             <?php
  62.             $user = get_userdata($auction->get_auction_current_bider());
  63.             echo "Winner is: ". $user->first_name;
  64.  
  65.             do_action( 'woocommerce_before_shop_loop_item' );
  66.  
  67.             do_action( 'woocommerce_before_shop_loop_item_title' );
  68.  
  69.             do_action( 'woocommerce_shop_loop_item_title' );
  70.  
  71.             do_action( 'woocommerce_after_shop_loop_item_title' );
  72.  
  73.             do_action( 'woocommerce_after_shop_loop_item' );
  74.             ?>
  75.         </li>
  76.         <?php
  77.             // wc_get_template_part( 'content', 'product' );
  78.            
  79.            
  80.         }
  81.        
  82.  
  83.         woocommerce_product_loop_end();
  84.  
  85.         do_action( 'woocommerce_after_shop_loop' );
  86.     } else {
  87.  
  88.         do_action( 'woocommerce_no_products_found' );
  89.     }
  90.  
  91. do_action( 'woocommerce_after_main_content' );
  92.  
  93. do_action( 'woocommerce_sidebar' );
  94.  
  95. get_footer( 'shop' );
  96.  
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×