WIP
This commit is contained in:
86
config.php
86
config.php
@@ -1,6 +1,13 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
"debug" => true,
|
||||
"flex-file-prefix" => "flex",
|
||||
|
||||
"options-pages" => [
|
||||
"Site Options",
|
||||
],
|
||||
|
||||
/**
|
||||
* excerpt-length
|
||||
*
|
||||
@@ -26,6 +33,7 @@ return [
|
||||
*/
|
||||
"menu-locations" => [
|
||||
"main-nav" => "Main Navigation",
|
||||
"footer-nav" => "Footer Customer Support Navigation",
|
||||
],
|
||||
|
||||
|
||||
@@ -34,7 +42,22 @@ return [
|
||||
*
|
||||
* here is where you can define your custom post types easily
|
||||
*/
|
||||
"custom-post-types" => [],
|
||||
"custom-post-types" => [
|
||||
[
|
||||
"slug" => "location",
|
||||
"archive" => true,
|
||||
"options-pages" => "Locations Landing Page",
|
||||
"options" => [
|
||||
"supports" => ["title", "thumbnail"],
|
||||
]
|
||||
],
|
||||
[
|
||||
"slug" => "testimonial",
|
||||
"options" => [
|
||||
"supports" => ["title", "thumbnail"],
|
||||
]
|
||||
],
|
||||
],
|
||||
|
||||
|
||||
/**
|
||||
@@ -47,7 +70,9 @@ return [
|
||||
*/
|
||||
"handlebars" => [
|
||||
"additional-helpers" => [
|
||||
"formatDate" => \Helpers\DateFormatter::monthDayYear(),
|
||||
"testimonial" => \Helpers\McCansHelpers::testimonial(),
|
||||
"locationTile" => \Helpers\McCansHelpers::locationTile(),
|
||||
"productTile" => \Helpers\McCansHelpers::productTile(),
|
||||
],
|
||||
],
|
||||
|
||||
@@ -60,6 +85,7 @@ return [
|
||||
"enable" => [
|
||||
"post-thumbnails",
|
||||
"menus",
|
||||
"woocommerce",
|
||||
],
|
||||
|
||||
|
||||
@@ -70,5 +96,61 @@ return [
|
||||
*/
|
||||
"disable" => [
|
||||
"editor",
|
||||
"customizer",
|
||||
"gutenberg",
|
||||
"patterns",
|
||||
"emojis",
|
||||
"meta-generator",
|
||||
"woocommerce.breadcrumb",
|
||||
"woocommerce.sidebar",
|
||||
"woocommerce.result_count",
|
||||
"woocommerce.page_title",
|
||||
],
|
||||
|
||||
"hooks" => [
|
||||
"woocommerce_before_main_content" => function () {
|
||||
// shop page
|
||||
if (is_shop()) {
|
||||
echo site()->render("shop-top", site()->getPost(wc_get_page_id('shop'), ["headline", "intro_text", 'thumbnail']));
|
||||
echo site()->render('woocommerce-before-content');
|
||||
return;
|
||||
}
|
||||
|
||||
echo site()->render('woocommerce-before-content');
|
||||
},
|
||||
"woocommerce_after_main_content" => function () {
|
||||
echo site()->render('woocommerce-after-content');
|
||||
},
|
||||
"init" => function() {
|
||||
remove_all_actions( 'woocommerce_before_shop_loop_item' );
|
||||
remove_all_actions( 'woocommerce_before_shop_loop_item_title' );
|
||||
remove_all_actions( 'woocommerce_shop_loop_item_title' );
|
||||
remove_all_actions( 'woocommerce_after_shop_loop_item_title' );
|
||||
remove_all_actions( 'woocommerce_after_shop_loop_item' );
|
||||
add_action( 'woocommerce_shop_loop_item_title', function() {
|
||||
global $product;
|
||||
|
||||
$data = site()->getPost($product->id, [
|
||||
"url",
|
||||
"id",
|
||||
"title",
|
||||
"thumbnail",
|
||||
"woocommerce.price",
|
||||
"woocommerce.attribute.msrp",
|
||||
"woocommerce.cartUrl",
|
||||
"woocommerce.sku",
|
||||
]);
|
||||
|
||||
if ($data["price"] && $data["msrp"]) {
|
||||
$difference = $data["msrp"] - $data["price"];
|
||||
|
||||
if ($difference > 0) {
|
||||
$data["savings"] = round(($difference / $data["msrp"]) * 100);
|
||||
}
|
||||
}
|
||||
|
||||
echo site()->render("product-tile", $data);
|
||||
});
|
||||
}
|
||||
],
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user