-
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.
* [#37] setting up new block and pattern * [#37] setting up test templates * [#37] place holder stuff * [#37] refactor and pulling in scripts * [#37] pulling the auction info * [#37] updating pattern adding bid-now block * [#37] adding reward product info * [#37] adding excerpt to action post * [#37] refactor moving pattern to mu plugin * [#37] Removing text if not custom values in Auction * [#37] refactor PR
- Loading branch information
1 parent
7ccc537
commit 8ae1471
Showing
11 changed files
with
198 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
15 changes: 15 additions & 0 deletions
15
client-mu-plugins/goodbids/blocks/reward-product-gallery/block.json
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,15 @@ | ||
{ | ||
"name": "reward-product-gallery", | ||
"title": "Reward Product Gallery", | ||
"description": "Displays the reward product gallery images", | ||
"icon": "format-gallery", | ||
"category": "goodbids", | ||
"textdomain": "goodbids", | ||
"keywords": ["custom", "gallery", "product", "reward", "auction"], | ||
"acf": { | ||
"mode": "preview" | ||
}, | ||
"supports": { | ||
"jsx": false | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
client-mu-plugins/goodbids/blocks/reward-product-gallery/block.php
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,29 @@ | ||
<?php | ||
/** | ||
* Initialize the WooCommerce Gallery Script | ||
* | ||
* @since 1.0.0 | ||
* | ||
* @return void | ||
*/ | ||
|
||
|
||
add_action( | ||
'wp_enqueue_scripts', | ||
function () { | ||
if ( is_singular( 'gb-auction' ) ) { | ||
if ( current_theme_supports( 'wc-product-gallery-zoom' ) ) { | ||
wp_enqueue_script( 'zoom' ); | ||
} | ||
if ( current_theme_supports( 'wc-product-gallery-slider' ) ) { | ||
wp_enqueue_script( 'flexslider' ); | ||
} | ||
if ( current_theme_supports( 'wc-product-gallery-lightbox' ) ) { | ||
wp_enqueue_script( 'photoswipe-ui-default' ); | ||
wp_enqueue_style( 'photoswipe-default-skin' ); | ||
add_action( 'wp_footer', 'woocommerce_photoswipe' ); | ||
} | ||
wp_enqueue_script( 'wc-single-product' ); | ||
} | ||
} | ||
); |
31 changes: 31 additions & 0 deletions
31
client-mu-plugins/goodbids/blocks/reward-product-gallery/render.php
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,31 @@ | ||
<?php | ||
/** | ||
* Block: Reward Product Gallery | ||
* | ||
* @global array $block | ||
* | ||
* @since 1.0.0 | ||
* @package GoodBids | ||
*/ | ||
|
||
global $product; | ||
$reward_id = goodbids()->auctions->get_reward_product_id( goodbids()->auctions->get_auction_id() ); | ||
$reward = wc_get_product( $reward_id ); | ||
if ( $reward ) { | ||
$product = $reward; | ||
} | ||
?> | ||
|
||
|
||
<section <?php block_attr( $block ); ?>> | ||
<?php | ||
if ( $product ) { | ||
wc_get_template( 'single-product/product-image.php' ); | ||
} else { | ||
printf( | ||
'<p style="text-align: center;">%s</p>', | ||
esc_html__( 'No Auction Product selected', 'goodbids' ) | ||
); | ||
} | ||
?> | ||
</section> |
15 changes: 15 additions & 0 deletions
15
client-mu-plugins/goodbids/blocks/reward-product/block.json
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,15 @@ | ||
{ | ||
"name": "reward-product", | ||
"title": "Reward Product", | ||
"description": "Displays the reward product information", | ||
"icon": "awards", | ||
"category": "goodbids", | ||
"textdomain": "goodbids", | ||
"keywords": ["custom", "product", "reward", "auction"], | ||
"acf": { | ||
"mode": "preview" | ||
}, | ||
"supports": { | ||
"jsx": false | ||
} | ||
} |
43 changes: 43 additions & 0 deletions
43
client-mu-plugins/goodbids/blocks/reward-product/render.php
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,43 @@ | ||
<?php | ||
/** | ||
* Block: Reward Product | ||
* | ||
* @global array $block | ||
* | ||
* @since 1.0.0 | ||
* @package GoodBids | ||
*/ | ||
|
||
$goal = goodbids()->auctions->get_goal( goodbids()->auctions->get_auction_id() ); | ||
$estimated_value = goodbids()->auctions->get_estimated_value( $auction_id ); | ||
$expected_high_bid = goodbids()->auctions->get_expected_high_bid( $auction_id ); | ||
?> | ||
|
||
|
||
<section <?php block_attr( $block ); ?>> | ||
<?php | ||
// Goal | ||
if ( $goal ) { | ||
printf( | ||
'<p style="text-align: center;">%s</p>', | ||
esc_html__( $goal, 'goodbids' ) | ||
); | ||
} | ||
|
||
// Estimated Value | ||
if ( $estimated_value ) { | ||
printf( | ||
'<p style="text-align: center;">%s</p>', | ||
esc_html__( $estimated_value, 'goodbids' ) | ||
); | ||
} | ||
|
||
// Expected High Bid | ||
if ( $expected_high_bid ) { | ||
printf( | ||
'<p style="text-align: center;">%s</p>', | ||
esc_html__( $expected_high_bid, 'goodbids' ) | ||
); | ||
} | ||
?> | ||
</section> |
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
39 changes: 39 additions & 0 deletions
39
client-mu-plugins/goodbids/views/patterns/template-auction.php
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,39 @@ | ||
<?php | ||
/** | ||
* Pattern: Auction Template | ||
* | ||
* Auto loaded as the default template for the gb-auction custom post type | ||
* | ||
* @since 1.0.0 | ||
* @package GoodBids | ||
*/ | ||
|
||
?> | ||
|
||
<!-- wp:group {"tagName":"main","align":"wide"} --> | ||
<main class="wp-block-group alignwide"> | ||
<!-- wp:columns --> | ||
<div class="wp-block-columns"> | ||
<!-- wp:column --> | ||
<div class="wp-block-column"> | ||
<!-- wp:post-featured-image {"style":{"spacing":{"margin":{"bottom":"var:preset|spacing|40"}}}} /--> | ||
|
||
<!-- wp:acf/reward-product-gallery {"name":"acf/reward-product-gallery","mode":"preview"} /--> | ||
</div> | ||
<!-- /wp:column --> | ||
|
||
<!-- wp:column --> | ||
<div class="wp-block-column"> | ||
<!-- wp:post-title /--> | ||
|
||
<!-- wp:post-excerpt /--> | ||
|
||
<!-- wp:acf/reward-product {"name":"acf/reward-product","mode":"preview"} /--> | ||
|
||
<!-- wp:acf/bid-now {"name":"acf/bid-now","data":{},"mode":"preview"} /--> | ||
</div> | ||
<!-- /wp:column --> | ||
</div> | ||
<!-- /wp:columns --> | ||
</main> | ||
<!-- /wp:group --> |
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,3 @@ | ||
<!-- wp:template-part {"slug":"header","area":"header","tagName":"header"} /--> | ||
<!-- wp:post-content {"lock":{"move":false,"remove":false},"align":"full"} /--> | ||
<!-- wp:template-part {"slug":"footer","area":"footer","tagName":"footer"} /--> |