PATH:
home
/
lab2454c
/
incforce.com
/
wp-content
/
themes
/
incforce
<?php /** * The template for displaying all single posts * * @link https://developer.wordpress.org/themes/basics/template-hierarchy/#single-post * * @package WP_Bootstrap_Starter */ session_start(); get_header();?> <?php get_template_part('template-parts/inner', 'banner-section'); ?> <!--start main div --> <div class="body__container__wrapp body__container__wrapp__inner"> <?php while (have_posts()): the_post(); ?> <div class="auction__single" id="post-<?php the_ID();?>" <?php post_class();?>> <div class="container"> <div class="image__box"> <?php the_post_thumbnail(); ?> </div> <div class="heading__wrapp"> <?php $auction_sub_title = get_field('auction_sub_title'); if (is_single()): ?> <h2 style="text-align:center;"><?php echo $auction_sub_title; ?></h2> <?php endif; if ('post' === get_post_type()): ?> <div class="entry-meta"> <?php wp_bootstrap_starter_posted_on();?> </div><!-- .entry-meta --> <?php endif;?> </div><!-- .entry-header --> <?php // Get auction details $last_bid_amount = get_post_meta(get_the_ID(), 'last_bid_amount', true); $asking_price = get_field('asking_price'); $user_id = get_field('user_id'); $username = get_userdata($user_id)->user_login; ?> <?php // Handle bid submission if ($_SERVER['REQUEST_METHOD'] === 'POST') { // Check if user is logged in if (!is_user_logged_in()) { echo 'You must be logged in to place a bid.'; return; } $new_bid = $_POST['bid_amount']; // Validate the bid amount (add your own validation logic) $new_bid = floatval($_POST['bid_amount']); // Validate the bid amount (add your own validation logic) if ($new_bid <= $last_bid_amount) { echo 'Invalid bid amount. The bid must be higher than the current bid.'; } else { // Update current bid //update_field('asking_price', $new_bid); // Store user-related information (e.g., user ID) $user_id = get_current_user_id(); update_field('user_id', $user_id); // Update current_bid variable with the new bid value //$asking_price = $new_bid; // Store bid information in post meta update_post_meta(get_the_ID(), 'last_bid_amount', $new_bid); update_post_meta(get_the_ID(), 'last_bid_username', get_userdata($user_id)->user_login); // Display the most recent bid information // $last_bid_amount = $new_bid; // $formatted_bid_amount = number_format($last_bid_amount, 2); // $username = get_userdata($user_id)->user_login; // Display bid placed successfully message echo 'Bid placed successfully.'; } } ?> <h6 class="asking__price">Asking Price: <?php echo '$' . number_format($asking_price, 2); ?></h6> <?php if (is_user_logged_in()) : ?> <form method="POST"> <label for="bid_amount">Bid Now:</label> <input type="number" name="bid_amount" id="bid_amount" step="0.01" required> <input type="submit" value="Place Bid"> </form> <?php else : ?> <p>You must be logged in to place a bid.</p> <?php endif; ?> <?php // Retrieve last bid information from post meta $last_bid_amount = get_post_meta(get_the_ID(), 'last_bid_amount', true); $last_bid_username = get_post_meta(get_the_ID(), 'last_bid_username', true); if (isset($last_bid_amount) && isset($last_bid_username)) : ?> <p>Last Asking Bid Submitted: <?php echo '$' . number_format($last_bid_amount, 2); ?></p> <?php else: ?> <p>No bids have been placed yet.</p> <?php endif;?> <div class="entry-content"> <?php $auction_content = get_field('auction_content'); if (is_single()): ?> <p><?php echo $auction_content; ?></p> <?php endif; wp_link_pages(array( 'before' => '<div class="page-links">' . esc_html__('Pages:', 'wp-bootstrap-starter'), 'after' => '</div>', )); ?> </div><!-- .entry-content --> </div> </div><!-- #post-## --> <?php endwhile; // End of the loop. ?> </div><!-- #main --> <?php //get_template_part('template-parts/common','news-letter-section'); ?> <?php //get_sidebar(); get_footer();
[+]
woocommerce
[-] template-book-tour.php
[edit]
[-] footer-widget.php
[edit]
[-] search.php
[edit]
[-] index.php
[edit]
[-] woocommerce.php
[edit]
[-] page.php
[edit]
[-] searchform.php
[edit]
[+]
..
[-] sidebar.php
[edit]
[-] rtl.css
[edit]
[-] template-contact-us.php
[edit]
[-] blank-page-with-container.php
[edit]
[-] single.php
[edit]
[-] footer.php
[edit]
[-] template-about.php
[edit]
[-] template-home.php
[edit]
[-] template-membership-and-pricing.php
[edit]
[-] template-create-account.php
[edit]
[-] blank-page.php
[edit]
[-] left-sidebar.php
[edit]
[-] header.php
[edit]
[-] template-news.php
[edit]
[-] style.css
[edit]
[-] 404.php
[edit]
[-] readme.txt
[edit]
[-] single-auction.php
[edit]
[-] single-attachment.php
[edit]
[-] screenshot.png
[edit]
[-] custom-editor-style.css
[edit]
[-] template-join-today.php
[edit]
[-] template-offering-workspace.php
[edit]
[-] template-memebership-levels.php
[edit]
[-] functions.php
[edit]
[-] archive.php
[edit]
[-] fullwidth.php
[edit]
[+]
template-parts
[-] comments.php
[edit]
[+]
inc
[-] template-member-portal.php
[edit]