Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php /* Template Name: Auctions Not Paid Template */ ?>
- <?php
- /* visit us - https://wpgenie.org */
- /* WP page template that shows all auctions that are not paid for with info about winning bid, winning user and pay now button */
- defined( 'ABSPATH' ) || exit;
- get_header( 'shop' );
- do_action( 'woocommerce_before_main_content' );
- ?>
- <header class="woocommerce-products-header">
- <h1 class="woocommerce-products-header__title page-title">Auctions Not Paid For</h1>
- <?php
- do_action( 'woocommerce_archive_description' );
- ?>
- </header>
- <?php
- // Return sucessfully finished auctions IDs but not paid for yet.
- $args = array(
- 'post_type' => 'product',
- 'show_past_auctions' => TRUE,
- 'tax_query' => array(array('taxonomy' => 'product_type' , 'field' => 'slug', 'terms' => 'auction')),
- 'meta_query' => array(
- 'relation' => 'AND',
- array(
- 'key' => '_auction_closed',
- 'value' => '2',
- 'operator' => '=',
- ),
- ),
- 'auction_arhive' => TRUE,
- 'show_past_auctions' => TRUE
- );
- $the_query = new WP_Query( $args );
- if ( $the_query->have_posts() ) {
- do_action( 'woocommerce_before_shop_loop' );
- woocommerce_product_loop_start();
- while ( $the_query->have_posts() ) {
- $the_query->the_post();
- $auction = wc_get_product($post->ID);
- do_action( 'woocommerce_shop_loop' );
- ?>
- <li <?php wc_product_class( '', $product ); ?>>
- <?php
- $user = get_userdata($auction->get_auction_current_bider());
- echo "Winner is: ". $user->first_name;
- do_action( 'woocommerce_before_shop_loop_item' );
- do_action( 'woocommerce_before_shop_loop_item_title' );
- do_action( 'woocommerce_shop_loop_item_title' );
- do_action( 'woocommerce_after_shop_loop_item_title' );
- do_action( 'woocommerce_after_shop_loop_item' );
- ?>
- </li>
- <?php
- // wc_get_template_part( 'content', 'product' );
- }
- woocommerce_product_loop_end();
- do_action( 'woocommerce_after_shop_loop' );
- } else {
- do_action( 'woocommerce_no_products_found' );
- }
- do_action( 'woocommerce_after_main_content' );
- do_action( 'woocommerce_sidebar' );
- get_footer( 'shop' );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement