-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
90 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"name": "bid-now", | ||
"title": "Bid Now Button", | ||
"description": "Displays a bid now button for the current Auction.", | ||
"icon": "money-alt", | ||
"category": "goodbids", | ||
"keywords": ["bid", "purchase", "donate", "button", "submit", "cart"], | ||
"acf": { | ||
"mode": "preview" | ||
}, | ||
"supports": { | ||
"jsx": false | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
/** | ||
* Block: Bid Now | ||
* | ||
* @global array $block | ||
* | ||
* @since 1.0.0 | ||
* @package GoodBids | ||
*/ | ||
|
||
if ( ! is_admin() && goodbids()->auctions->get_post_type() !== get_post_type() ) : | ||
// Bail early if we're not inside an Auction post type. | ||
return; | ||
endif; | ||
|
||
$auction_id = goodbids()->auctions->get_auction_id(); | ||
$bid_product_id = goodbids()->auctions->get_bid_product_id( $auction_id ); | ||
|
||
$classes = 'wp-block-buttons is-vertical is-content-justification-center is-layout-flex wp-block-buttons-is-layout-flex'; | ||
$button_url = $bid_product_id && ! is_admin() ? add_query_arg( 'add-to-cart', $bid_product_id, wc_get_checkout_url() ) : '#'; | ||
?> | ||
<div <?php block_attr( $block, $classes ); ?>> | ||
<div class="wp-block-button has-custom-width wp-block-button__width-100"> | ||
<a href="<?php echo esc_url( $button_url ); ?>" class="wp-block-button__link wp-element-button"> | ||
<?php esc_html_e( 'Bid Now', 'goodbids' ); ?> | ||
</a> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -271,4 +271,5 @@ function () { | |
2 | ||
); | ||
} | ||
|
||
} |