shop changes
This commit is contained in:
20
actions/WooCommerceAfterContent.php
Normal file
20
actions/WooCommerceAfterContent.php
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Actions;
|
||||||
|
|
||||||
|
use ofc\RadAction;
|
||||||
|
|
||||||
|
class WooCommerceAfterContent extends RadAction
|
||||||
|
{
|
||||||
|
protected string $hookName = "woocommerce_after_main_content";
|
||||||
|
protected int $priority = 50;
|
||||||
|
|
||||||
|
public function callback()
|
||||||
|
{
|
||||||
|
if (is_product()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
echo site()->render('woocommerce-after-content');
|
||||||
|
}
|
||||||
|
}
|
||||||
16
actions/WooCommerceAfterProductSummary.php
Normal file
16
actions/WooCommerceAfterProductSummary.php
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Actions;
|
||||||
|
|
||||||
|
use ofc\RadAction;
|
||||||
|
|
||||||
|
class WooCommerceAfterProductSummary extends RadAction
|
||||||
|
{
|
||||||
|
protected string $hookName = "woocommerce_after_single_product_summary";
|
||||||
|
protected int $priority = 0;
|
||||||
|
|
||||||
|
public function callback()
|
||||||
|
{
|
||||||
|
echo site()->render('woocommerce-before-content');
|
||||||
|
}
|
||||||
|
}
|
||||||
18
actions/WooCommerceBeforeProductSummary.php
Normal file
18
actions/WooCommerceBeforeProductSummary.php
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Actions;
|
||||||
|
|
||||||
|
use ofc\RadAction;
|
||||||
|
|
||||||
|
class WooCommerceBeforeProductSummary extends RadAction
|
||||||
|
{
|
||||||
|
protected string $hookName = "woocommerce_before_single_product_summary";
|
||||||
|
protected int $priority = 0;
|
||||||
|
|
||||||
|
public function callback()
|
||||||
|
{
|
||||||
|
echo site()->render('woocommerce-before-content', [
|
||||||
|
"additionalTopLevelClass" => "single-product-top",
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
45
actions/WooCommerceCategoryLayout.php
Normal file
45
actions/WooCommerceCategoryLayout.php
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Actions;
|
||||||
|
|
||||||
|
use ofc\RadAction;
|
||||||
|
|
||||||
|
class WooCommerceCategoryLayout extends RadAction
|
||||||
|
{
|
||||||
|
protected string $hookName = "woocommerce_before_main_content";
|
||||||
|
protected int $priority = 5;
|
||||||
|
|
||||||
|
public function callback()
|
||||||
|
{
|
||||||
|
if (!is_product_category()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
echo site()->render("shop-category-slice", site()->getQueriedObject(null, [
|
||||||
|
"title",
|
||||||
|
"description",
|
||||||
|
"thumbnail",
|
||||||
|
"url",
|
||||||
|
"acf.intro_headline",
|
||||||
|
"acf.intro_content",
|
||||||
|
]));
|
||||||
|
|
||||||
|
$type = site()->getQueriedObject(null, ['display_type']);
|
||||||
|
if ($type === "") {
|
||||||
|
$type = "products";
|
||||||
|
} else {
|
||||||
|
$type = $type["display_type"];
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($type === "both" || $type === "subcategories") {
|
||||||
|
$childCats = site()->getQueriedObject(null, ["children.url,thumbnail,title,count"]);
|
||||||
|
|
||||||
|
echo site()->render("shop-sub-categories", $childCats);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($type === "both" || $type === "products") {
|
||||||
|
// die("why?");
|
||||||
|
}
|
||||||
|
echo site()->render('woocommerce-before-content');
|
||||||
|
}
|
||||||
|
}
|
||||||
30
actions/WooCommerceCategoryLayoutHideProducts.php
Normal file
30
actions/WooCommerceCategoryLayoutHideProducts.php
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Actions;
|
||||||
|
|
||||||
|
use ofc\RadAction;
|
||||||
|
|
||||||
|
class WooCommerceCategoryLayoutHideProducts extends RadAction
|
||||||
|
{
|
||||||
|
protected string $hookName = "woocommerce_before_main_content";
|
||||||
|
|
||||||
|
public function callback()
|
||||||
|
{
|
||||||
|
if (!is_product_category()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$type = site()->getQueriedObject(null, ['display_type']);
|
||||||
|
if ($type === "") {
|
||||||
|
$type = "products";
|
||||||
|
} else {
|
||||||
|
$type = $type["display_type"];
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($type != "subcategories") {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
echo site()->render("hideProducts");
|
||||||
|
}
|
||||||
|
}
|
||||||
20
actions/WooCommerceCleanup.php
Normal file
20
actions/WooCommerceCleanup.php
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Actions;
|
||||||
|
|
||||||
|
use ofc\RadAction;
|
||||||
|
|
||||||
|
class WooCommerceCleanup extends RadAction
|
||||||
|
{
|
||||||
|
protected string $hookName = "init";
|
||||||
|
protected int $priority = 5;
|
||||||
|
|
||||||
|
public function callback()
|
||||||
|
{
|
||||||
|
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');
|
||||||
|
}
|
||||||
|
}
|
||||||
15
actions/WooCommerceProductSummary.php
Normal file
15
actions/WooCommerceProductSummary.php
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Actions;
|
||||||
|
|
||||||
|
use ofc\RadAction;
|
||||||
|
|
||||||
|
class WooCommerceProductSummary extends RadAction
|
||||||
|
{
|
||||||
|
protected string $hookName = "woocommerce_single_product_summary";
|
||||||
|
|
||||||
|
public function callback()
|
||||||
|
{
|
||||||
|
echo site()->render('woocommerce-after-content');
|
||||||
|
}
|
||||||
|
}
|
||||||
32
actions/WooCommerceProductTile.php
Normal file
32
actions/WooCommerceProductTile.php
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Actions;
|
||||||
|
|
||||||
|
use Helpers\McCansHelpers;
|
||||||
|
use ofc\RadAction;
|
||||||
|
|
||||||
|
class WooCommerceProductTile extends RadAction
|
||||||
|
{
|
||||||
|
protected string $hookName = "woocommerce_shop_loop_item_title";
|
||||||
|
protected bool $wrapInit = true;
|
||||||
|
|
||||||
|
public function callback()
|
||||||
|
{
|
||||||
|
global $product;
|
||||||
|
|
||||||
|
$data = site()->getPost($product->id, [
|
||||||
|
"url",
|
||||||
|
"id",
|
||||||
|
"title",
|
||||||
|
"thumbnail",
|
||||||
|
"woocommerce.price",
|
||||||
|
"woocommerce.attribute.msrp",
|
||||||
|
"woocommerce.cartUrl",
|
||||||
|
"woocommerce.sku",
|
||||||
|
]);
|
||||||
|
|
||||||
|
$data["savings"] = McCansHelpers::calcDifference($data["price"], $data["msrp"]);
|
||||||
|
|
||||||
|
echo site()->render("product-tile", $data);
|
||||||
|
}
|
||||||
|
}
|
||||||
26
actions/WooCommerceShopLayout.php
Normal file
26
actions/WooCommerceShopLayout.php
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Actions;
|
||||||
|
|
||||||
|
use ofc\RadAction;
|
||||||
|
|
||||||
|
class WooCommerceShopLayout extends RadAction
|
||||||
|
{
|
||||||
|
protected string $hookName = "woocommerce_before_main_content";
|
||||||
|
protected int $priority = 5;
|
||||||
|
|
||||||
|
public function callback()
|
||||||
|
{
|
||||||
|
if (!is_shop()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// shop page
|
||||||
|
echo site()->render("shop-top", site()->getPost(wc_get_page_id('shop'), [
|
||||||
|
"headline",
|
||||||
|
"intro_text",
|
||||||
|
"thumbnail",
|
||||||
|
]));
|
||||||
|
echo site()->render('woocommerce-before-content');
|
||||||
|
}
|
||||||
|
}
|
||||||
86
config.php
86
config.php
@@ -80,6 +80,7 @@ return [
|
|||||||
"renderCallout" => \Helpers\McCansHelpers::renderCallout(),
|
"renderCallout" => \Helpers\McCansHelpers::renderCallout(),
|
||||||
"productBox" => \Helpers\McCansHelpers::searchResultBox('product'),
|
"productBox" => \Helpers\McCansHelpers::searchResultBox('product'),
|
||||||
"pageBox" => \Helpers\McCansHelpers::searchResultBox('page'),
|
"pageBox" => \Helpers\McCansHelpers::searchResultBox('page'),
|
||||||
|
"categoryBox" => \Helpers\McCansHelpers::categoryBox(),
|
||||||
"usd" => \Helpers\McCansHelpers::usd(),
|
"usd" => \Helpers\McCansHelpers::usd(),
|
||||||
"fourColContent" => \Helpers\McCansHelpers::fourColContent(),
|
"fourColContent" => \Helpers\McCansHelpers::fourColContent(),
|
||||||
],
|
],
|
||||||
@@ -121,21 +122,6 @@ return [
|
|||||||
],
|
],
|
||||||
|
|
||||||
"actions" => [
|
"actions" => [
|
||||||
"woocommerce_before_single_product_summary" => [function () {
|
|
||||||
echo site()->render('woocommerce-before-content', [
|
|
||||||
"additionalTopLevelClass" => "single-product-top",
|
|
||||||
]);
|
|
||||||
}, 0],
|
|
||||||
"woocommerce_single_product_summary" => function () {
|
|
||||||
echo site()->render('woocommerce-after-content');
|
|
||||||
},
|
|
||||||
[
|
|
||||||
"hook" => "woocommerce_after_single_product_summary",
|
|
||||||
"priority" => 0,
|
|
||||||
"callback" => function () {
|
|
||||||
echo site()->render('woocommerce-before-content');
|
|
||||||
},
|
|
||||||
],
|
|
||||||
"woocommerce_after_single_product" => function () {
|
"woocommerce_after_single_product" => function () {
|
||||||
echo site()->render('woocommerce-after-content');
|
echo site()->render('woocommerce-after-content');
|
||||||
},
|
},
|
||||||
@@ -159,75 +145,5 @@ return [
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
||||||
"woocommerce_before_main_content" => [function () {
|
|
||||||
// skip this for individual products
|
|
||||||
if (is_product()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 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;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (is_product_category()) {
|
|
||||||
echo site()->render("shop-category-slice", site()->getQueriedObject(null, [
|
|
||||||
"title",
|
|
||||||
"description",
|
|
||||||
"thumbnail",
|
|
||||||
"url",
|
|
||||||
"acf.intro_headline",
|
|
||||||
"acf.intro_content",
|
|
||||||
]));
|
|
||||||
echo site()->render('woocommerce-before-content');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
echo site()->render('woocommerce-before-content');
|
|
||||||
}, 5],
|
|
||||||
[
|
|
||||||
"hook" => "woocommerce_after_main_content",
|
|
||||||
"callback" => function () {
|
|
||||||
// skip this for individual products
|
|
||||||
if (is_product()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
echo site()->render('woocommerce-after-content');
|
|
||||||
},
|
|
||||||
"priority" => 50,
|
|
||||||
],
|
|
||||||
"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",
|
|
||||||
]);
|
|
||||||
|
|
||||||
$data["savings"] = McCansHelpers::calcDifference($data["price"], $data["msrp"]);
|
|
||||||
|
|
||||||
echo site()->render("product-tile", $data);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|||||||
117
dist/app.css
vendored
117
dist/app.css
vendored
@@ -12327,7 +12327,7 @@ input, label, textarea {
|
|||||||
.top-bar a.account-button {
|
.top-bar a.account-button {
|
||||||
border: 0;
|
border: 0;
|
||||||
text-transform: uppercase;
|
text-transform: uppercase;
|
||||||
color: #ae1716;
|
color: #c80000;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
background: transparent;
|
background: transparent;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
@@ -12342,16 +12342,31 @@ input, label, textarea {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.main-nav {
|
.main-nav {
|
||||||
|
z-index: 3;
|
||||||
padding: 2rem 0;
|
padding: 2rem 0;
|
||||||
position: relative;
|
|
||||||
z-index: 2;
|
|
||||||
}
|
}
|
||||||
.main-nav .logo-wrapper {
|
|
||||||
|
.shop-nav {
|
||||||
|
z-index: 2;
|
||||||
|
padding: 1rem 0;
|
||||||
|
}
|
||||||
|
.shop-nav #menu-shop-navigation {
|
||||||
|
justify-content: center;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
.shop-nav .menu-shop-navigation-container {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.main-nav, .shop-nav {
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
.main-nav .logo-wrapper, .shop-nav .logo-wrapper {
|
||||||
max-width: 400px;
|
max-width: 400px;
|
||||||
width: 20%;
|
width: 20%;
|
||||||
}
|
}
|
||||||
@media (max-width: 991.98px) {
|
@media (max-width: 991.98px) {
|
||||||
.main-nav .logo-wrapper {
|
.main-nav .logo-wrapper, .shop-nav .logo-wrapper {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
@@ -12359,69 +12374,69 @@ input, label, textarea {
|
|||||||
gap: 3rem;
|
gap: 3rem;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
.main-nav .logo-wrapper img {
|
.main-nav .logo-wrapper img, .shop-nav .logo-wrapper img {
|
||||||
max-width: 250px;
|
max-width: 250px;
|
||||||
}
|
}
|
||||||
.main-nav .logo-wrapper a {
|
.main-nav .logo-wrapper a, .shop-nav .logo-wrapper a {
|
||||||
color: #000;
|
color: #000;
|
||||||
}
|
}
|
||||||
.main-nav .logo-wrapper svg {
|
.main-nav .logo-wrapper svg, .shop-nav .logo-wrapper svg {
|
||||||
width: 50px;
|
width: 50px;
|
||||||
height: 50px;
|
height: 50px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@media (max-width: 575.98px) {
|
@media (max-width: 575.98px) {
|
||||||
.main-nav .logo-wrapper {
|
.main-nav .logo-wrapper, .shop-nav .logo-wrapper {
|
||||||
gap: 1rem !important;
|
gap: 1rem !important;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@media (min-width: 992px) {
|
@media (min-width: 992px) {
|
||||||
.main-nav .logo-wrapper #mobile-nav-toggle {
|
.main-nav .logo-wrapper #mobile-nav-toggle, .shop-nav .logo-wrapper #mobile-nav-toggle {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.main-nav .logo-wrapper #mobile-nav-toggle svg:first-of-type {
|
.main-nav .logo-wrapper #mobile-nav-toggle svg:first-of-type, .shop-nav .logo-wrapper #mobile-nav-toggle svg:first-of-type {
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
.main-nav .logo-wrapper #mobile-nav-toggle svg:last-of-type {
|
.main-nav .logo-wrapper #mobile-nav-toggle svg:last-of-type, .shop-nav .logo-wrapper #mobile-nav-toggle svg:last-of-type {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
.mobile-nav-open .main-nav .logo-wrapper #mobile-nav-toggle svg:first-of-type {
|
.mobile-nav-open .main-nav .logo-wrapper #mobile-nav-toggle svg:first-of-type, .mobile-nav-open .shop-nav .logo-wrapper #mobile-nav-toggle svg:first-of-type {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
.mobile-nav-open .main-nav .logo-wrapper #mobile-nav-toggle svg:last-of-type {
|
.mobile-nav-open .main-nav .logo-wrapper #mobile-nav-toggle svg:last-of-type, .mobile-nav-open .shop-nav .logo-wrapper #mobile-nav-toggle svg:last-of-type {
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
.main-nav .logo-wrapper img {
|
.main-nav .logo-wrapper img, .shop-nav .logo-wrapper img {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
.main-nav nav.main-nav {
|
.main-nav nav.main-nav, .main-nav nav.shop-nav, .shop-nav nav.main-nav, .shop-nav nav.shop-nav {
|
||||||
display: none;
|
display: none;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
.mobile-nav-open .main-nav nav.main-nav {
|
.mobile-nav-open .main-nav nav.main-nav, .mobile-nav-open .main-nav nav.shop-nav, .mobile-nav-open .shop-nav nav.main-nav, .mobile-nav-open .shop-nav nav.shop-nav {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
}
|
}
|
||||||
@media (min-width: 992px) {
|
@media (min-width: 992px) {
|
||||||
.main-nav nav.main-nav {
|
.main-nav nav.main-nav, .main-nav nav.shop-nav, .shop-nav nav.main-nav, .shop-nav nav.shop-nav {
|
||||||
display: flex;
|
display: flex;
|
||||||
width: auto;
|
width: auto;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.main-nav .menu-main-menu-container {
|
.main-nav .menu-main-menu-container, .main-nav .menu-shop-navigation-container, .shop-nav .menu-main-menu-container, .shop-nav .menu-shop-navigation-container {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
@media (max-width: 991.98px) {
|
@media (max-width: 991.98px) {
|
||||||
.main-nav .menu-main-menu-container {
|
.main-nav .menu-main-menu-container, .main-nav .menu-shop-navigation-container, .shop-nav .menu-main-menu-container, .shop-nav .menu-shop-navigation-container {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
.main-nav .menu-main-menu-container > ul {
|
.main-nav .menu-main-menu-container > ul, .main-nav .menu-shop-navigation-container > ul, .shop-nav .menu-main-menu-container > ul, .shop-nav .menu-shop-navigation-container > ul {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.main-nav #menu-main-menu {
|
.main-nav #menu-main-menu, .main-nav #menu-shop-navigation, .shop-nav #menu-main-menu, .shop-nav #menu-shop-navigation {
|
||||||
display: flex;
|
display: flex;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
@@ -12429,20 +12444,20 @@ input, label, textarea {
|
|||||||
gap: 1rem;
|
gap: 1rem;
|
||||||
}
|
}
|
||||||
@media (max-width: 991.98px) {
|
@media (max-width: 991.98px) {
|
||||||
.main-nav #menu-main-menu {
|
.main-nav #menu-main-menu, .main-nav #menu-shop-navigation, .shop-nav #menu-main-menu, .shop-nav #menu-shop-navigation {
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.main-nav #menu-main-menu a {
|
.main-nav #menu-main-menu a, .main-nav #menu-shop-navigation a, .shop-nav #menu-main-menu a, .shop-nav #menu-shop-navigation a {
|
||||||
text-transform: uppercase;
|
text-transform: uppercase;
|
||||||
color: #000;
|
color: #000;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
.main-nav #menu-main-menu > li {
|
.main-nav #menu-main-menu > li, .main-nav #menu-shop-navigation > li, .shop-nav #menu-main-menu > li, .shop-nav #menu-shop-navigation > li {
|
||||||
position: relative;
|
position: relative;
|
||||||
}
|
}
|
||||||
@media (min-width: 1200px) {
|
@media (min-width: 1200px) {
|
||||||
.main-nav #menu-main-menu > li:hover > ul {
|
.main-nav #menu-main-menu > li:hover > ul, .main-nav #menu-shop-navigation > li:hover > ul, .shop-nav #menu-main-menu > li:hover > ul, .shop-nav #menu-shop-navigation > li:hover > ul {
|
||||||
display: block;
|
display: block;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 100%;
|
top: 100%;
|
||||||
@@ -12453,7 +12468,7 @@ input, label, textarea {
|
|||||||
padding: 10px 15px;
|
padding: 10px 15px;
|
||||||
transform: translate(-5px, -5px);
|
transform: translate(-5px, -5px);
|
||||||
}
|
}
|
||||||
.main-nav #menu-main-menu > li:hover > ul li a {
|
.main-nav #menu-main-menu > li:hover > ul li a, .main-nav #menu-shop-navigation > li:hover > ul li a, .shop-nav #menu-main-menu > li:hover > ul li a, .shop-nav #menu-shop-navigation > li:hover > ul li a {
|
||||||
padding-top: 5px;
|
padding-top: 5px;
|
||||||
padding-bottom: 5px;
|
padding-bottom: 5px;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
@@ -12461,25 +12476,25 @@ input, label, textarea {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
@media (max-width: 991.98px) {
|
@media (max-width: 991.98px) {
|
||||||
.main-nav #menu-main-menu > li.children-showing ul {
|
.main-nav #menu-main-menu > li.children-showing ul, .main-nav #menu-shop-navigation > li.children-showing ul, .shop-nav #menu-main-menu > li.children-showing ul, .shop-nav #menu-shop-navigation > li.children-showing ul {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
list-style-type: none;
|
list-style-type: none;
|
||||||
}
|
}
|
||||||
.main-nav #menu-main-menu > li.children-showing ul li {
|
.main-nav #menu-main-menu > li.children-showing ul li, .main-nav #menu-shop-navigation > li.children-showing ul li, .shop-nav #menu-main-menu > li.children-showing ul li, .shop-nav #menu-shop-navigation > li.children-showing ul li {
|
||||||
position: relative;
|
position: relative;
|
||||||
}
|
}
|
||||||
.main-nav #menu-main-menu > li.children-showing ul a {
|
.main-nav #menu-main-menu > li.children-showing ul a, .main-nav #menu-shop-navigation > li.children-showing ul a, .shop-nav #menu-main-menu > li.children-showing ul a, .shop-nav #menu-shop-navigation > li.children-showing ul a {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
.main-nav #menu-main-menu > li.children-showing .toggle-sub-nav {
|
.main-nav #menu-main-menu > li.children-showing .toggle-sub-nav, .main-nav #menu-shop-navigation > li.children-showing .toggle-sub-nav, .shop-nav #menu-main-menu > li.children-showing .toggle-sub-nav, .shop-nav #menu-shop-navigation > li.children-showing .toggle-sub-nav {
|
||||||
transform: rotate(180deg);
|
transform: rotate(180deg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.main-nav #menu-main-menu ul {
|
.main-nav #menu-main-menu ul, .main-nav #menu-shop-navigation ul, .shop-nav #menu-main-menu ul, .shop-nav #menu-shop-navigation ul {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
.main-nav .toggle-sub-nav {
|
.main-nav .toggle-sub-nav, .shop-nav .toggle-sub-nav {
|
||||||
width: 16px;
|
width: 16px;
|
||||||
height: 16px;
|
height: 16px;
|
||||||
background-image: url("/wp-content/themes/mccans-theme/assets/chevron-down.svg");
|
background-image: url("/wp-content/themes/mccans-theme/assets/chevron-down.svg");
|
||||||
@@ -12490,7 +12505,7 @@ input, label, textarea {
|
|||||||
background-color: transparent;
|
background-color: transparent;
|
||||||
}
|
}
|
||||||
@media (max-width: 991.98px) {
|
@media (max-width: 991.98px) {
|
||||||
.main-nav .toggle-sub-nav {
|
.main-nav .toggle-sub-nav, .shop-nav .toggle-sub-nav {
|
||||||
width: 30px;
|
width: 30px;
|
||||||
height: 30px;
|
height: 30px;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
@@ -12539,7 +12554,7 @@ footer.site-footer nav#social-nav ul a {
|
|||||||
}
|
}
|
||||||
footer.site-footer nav#social-nav ul a:hover {
|
footer.site-footer nav#social-nav ul a:hover {
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
color: #ae1716;
|
color: #c80000;
|
||||||
}
|
}
|
||||||
footer.site-footer .logo-col {
|
footer.site-footer .logo-col {
|
||||||
max-width: 336px;
|
max-width: 336px;
|
||||||
@@ -12695,7 +12710,7 @@ footer.sub-footer {
|
|||||||
font-size: 20px;
|
font-size: 20px;
|
||||||
}
|
}
|
||||||
.testimonials-section .testimonials .slick-dots li.slick-active button:before {
|
.testimonials-section .testimonials .slick-dots li.slick-active button:before {
|
||||||
color: #ae1716;
|
color: #c80000;
|
||||||
}
|
}
|
||||||
.testimonials-section .testimonials .testimonial {
|
.testimonials-section .testimonials .testimonial {
|
||||||
background: #fff;
|
background: #fff;
|
||||||
@@ -13062,11 +13077,17 @@ div.product-tile a.learn-more, div.page-tile a.learn-more {
|
|||||||
|
|
||||||
.page-tile h2, .page-tile .h2 {
|
.page-tile h2, .page-tile .h2 {
|
||||||
text-align: left !important;
|
text-align: left !important;
|
||||||
font-size: 32px !important;
|
font-size: 24px !important;
|
||||||
line-height: 37px !important;
|
line-height: 30px !important;
|
||||||
text-transform: uppercase;
|
text-transform: uppercase;
|
||||||
margin: 1rem 0;
|
margin: 1rem 0;
|
||||||
}
|
}
|
||||||
|
@media (min-width: 1200px) {
|
||||||
|
.page-tile h2, .page-tile .h2 {
|
||||||
|
font-size: 32px !important;
|
||||||
|
line-height: 37px !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.category-slice-top {
|
.category-slice-top {
|
||||||
background-color: #f2f2f2;
|
background-color: #f2f2f2;
|
||||||
@@ -13158,7 +13179,7 @@ div.product-tile a.learn-more, div.page-tile a.learn-more {
|
|||||||
height: 500px;
|
height: 500px;
|
||||||
}
|
}
|
||||||
.post-type-archive-location .location-tile h2, .post-type-archive-location .location-tile .h2 {
|
.post-type-archive-location .location-tile h2, .post-type-archive-location .location-tile .h2 {
|
||||||
color: #ae1716;
|
color: #c80000;
|
||||||
text-transform: uppercase;
|
text-transform: uppercase;
|
||||||
margin-bottom: 0;
|
margin-bottom: 0;
|
||||||
}
|
}
|
||||||
@@ -13206,3 +13227,21 @@ div.product-tile a.learn-more, div.page-tile a.learn-more {
|
|||||||
.search-results .tile-wrapper {
|
.search-results .tile-wrapper {
|
||||||
margin-bottom: 1.5rem;
|
margin-bottom: 1.5rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.category-sub-cats-wrapper .sub-cats {
|
||||||
|
flex-wrap: wrap;
|
||||||
|
margin-top: 2rem;
|
||||||
|
}
|
||||||
|
.category-sub-cats-wrapper .sub-cats .page-tile {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
@media (min-width: 768px) {
|
||||||
|
.category-sub-cats-wrapper .sub-cats .page-tile {
|
||||||
|
width: calc(50% - 0.5rem);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@media (min-width: 992px) {
|
||||||
|
.category-sub-cats-wrapper .sub-cats .page-tile {
|
||||||
|
width: calc(25% - 0.75rem);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
2
dist/mix-manifest.json
vendored
2
dist/mix-manifest.json
vendored
@@ -1,4 +1,4 @@
|
|||||||
{
|
{
|
||||||
"/app.js": "/app.js?id=8af0c9c0d989b79afe124f8138dc1a63",
|
"/app.js": "/app.js?id=8af0c9c0d989b79afe124f8138dc1a63",
|
||||||
"/app.css": "/app.css?id=830df460c7c9284d57346827424337f9"
|
"/app.css": "/app.css?id=a881c23833f0893c65814ff00ee9ff6e"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,5 +8,6 @@
|
|||||||
echo site()->render("header", [
|
echo site()->render("header", [
|
||||||
"accountHref" => get_permalink(73),
|
"accountHref" => get_permalink(73),
|
||||||
"menu" => site()->renderMenu("main-nav"),
|
"menu" => site()->renderMenu("main-nav"),
|
||||||
|
"shopMenu" => site()->renderMenu("shop-nav"),
|
||||||
"searchTerm" => $_GET["s"] ?? "",
|
"searchTerm" => $_GET["s"] ?? "",
|
||||||
]);
|
]);
|
||||||
|
|||||||
@@ -81,6 +81,15 @@ class McCansHelpers
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function categoryBox()
|
||||||
|
{
|
||||||
|
return function ($template, $context, $args, $source) {
|
||||||
|
$stuff = $context->get($args);
|
||||||
|
|
||||||
|
return site()->render("page-tile", $stuff);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
public static function renderBlock()
|
public static function renderBlock()
|
||||||
{
|
{
|
||||||
return function ($template, $context, $args, $source) {
|
return function ($template, $context, $args, $source) {
|
||||||
|
|||||||
@@ -31,3 +31,5 @@
|
|||||||
@import "locations";
|
@import "locations";
|
||||||
@import "location";
|
@import "location";
|
||||||
@import "search";
|
@import "search";
|
||||||
|
|
||||||
|
@import "woocommerce-changes";
|
||||||
|
|||||||
@@ -65,7 +65,7 @@
|
|||||||
&.slick-active {
|
&.slick-active {
|
||||||
button {
|
button {
|
||||||
&:before {
|
&:before {
|
||||||
color: $c-red;
|
color: $c-brightRed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ footer.site-footer {
|
|||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
background-color: $c-white;
|
background-color: $c-white;
|
||||||
color: $c-red;
|
color: $c-brightRed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
a.account-button {
|
a.account-button {
|
||||||
border: 0;
|
border: 0;
|
||||||
text-transform: uppercase;
|
text-transform: uppercase;
|
||||||
color: $c-red;
|
color: $c-brightRed;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
background: transparent;
|
background: transparent;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
@@ -30,9 +30,26 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.main-nav {
|
.main-nav {
|
||||||
|
z-index: 3;
|
||||||
padding: 2rem 0;
|
padding: 2rem 0;
|
||||||
position: relative;
|
}
|
||||||
|
|
||||||
|
.shop-nav {
|
||||||
z-index: 2;
|
z-index: 2;
|
||||||
|
padding: 1rem 0;
|
||||||
|
|
||||||
|
#menu-shop-navigation {
|
||||||
|
justify-content: center;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.menu-shop-navigation-container {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.main-nav, .shop-nav {
|
||||||
|
position: relative;
|
||||||
|
|
||||||
.logo-wrapper {
|
.logo-wrapper {
|
||||||
max-width: 400px;
|
max-width: 400px;
|
||||||
@@ -91,7 +108,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
nav.main-nav {
|
nav.main-nav, nav.shop-nav {
|
||||||
display: none;
|
display: none;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|
||||||
@@ -106,7 +123,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.menu-main-menu-container {
|
.menu-main-menu-container, .menu-shop-navigation-container {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|
||||||
@@ -119,7 +136,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#menu-main-menu {
|
#menu-main-menu, #menu-shop-navigation {
|
||||||
display: flex;
|
display: flex;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
|
|||||||
@@ -32,7 +32,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
h2 {
|
h2 {
|
||||||
color: $c-red;
|
color: $c-brightRed;
|
||||||
text-transform: uppercase;
|
text-transform: uppercase;
|
||||||
margin-bottom: 0;
|
margin-bottom: 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -134,9 +134,14 @@ div.product-tile, div.page-tile {
|
|||||||
h2 {
|
h2 {
|
||||||
@extend .montserrat;
|
@extend .montserrat;
|
||||||
text-align: left !important;
|
text-align: left !important;
|
||||||
font-size: 32px !important;
|
font-size: 24px !important;
|
||||||
line-height: 37px !important;
|
line-height: 30px !important;
|
||||||
text-transform: uppercase;
|
text-transform: uppercase;
|
||||||
margin: 1rem 0;
|
margin: 1rem 0;
|
||||||
|
|
||||||
|
@include media-breakpoint-up(xl) {
|
||||||
|
font-size: 32px !important;
|
||||||
|
line-height: 37px !important;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ $c-grey: #cbcbcb;
|
|||||||
$c-midGrey: #acacac;
|
$c-midGrey: #acacac;
|
||||||
$c-textAlt: #505050;
|
$c-textAlt: #505050;
|
||||||
$c-brightRed: #c80000;
|
$c-brightRed: #c80000;
|
||||||
$c-red: #ae1716;
|
|
||||||
|
|
||||||
$transition-time: 0.3s;
|
$transition-time: 0.3s;
|
||||||
|
|
||||||
|
|||||||
18
src/scss/woocommerce-changes.scss
Normal file
18
src/scss/woocommerce-changes.scss
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
.category-sub-cats-wrapper {
|
||||||
|
.sub-cats {
|
||||||
|
flex-wrap: wrap;
|
||||||
|
margin-top: 2rem;
|
||||||
|
|
||||||
|
.page-tile {
|
||||||
|
width: 100%;
|
||||||
|
|
||||||
|
@include media-breakpoint-up(md) {
|
||||||
|
width: calc(50% - 0.5rem);
|
||||||
|
}
|
||||||
|
|
||||||
|
@include media-breakpoint-up(lg) {
|
||||||
|
width: calc(25% - 0.75rem);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -61,3 +61,16 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
|
||||||
|
<section class="shop-nav">
|
||||||
|
<div class="container-fluid">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col">
|
||||||
|
<nav class="align-items-center gap-3 shop-nav">
|
||||||
|
{{{ shopMenu }}}
|
||||||
|
</nav>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|||||||
6
tpl/hideProducts.tpl
Normal file
6
tpl/hideProducts.tpl
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
<style>
|
||||||
|
.woocommerce-wrapper {
|
||||||
|
display: none;
|
||||||
|
visibility: hidden;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -3,7 +3,7 @@
|
|||||||
<img src="{{ thumbnail }}" alt="{{ title }}" />
|
<img src="{{ thumbnail }}" alt="{{ title }}" />
|
||||||
</a>
|
</a>
|
||||||
<h2>
|
<h2>
|
||||||
<a href="{{ url }}">{{{ title }}}</a>
|
<a href="{{ url }}">{{{ title }}}{{#if count}} ({{count}} Products){{/if}}</a>
|
||||||
</h2>
|
</h2>
|
||||||
<a href="{{ url }}" class="learn-more">Learn More {{#assetContents arrow-right.svg}}</a>
|
<a href="{{ url }}" class="learn-more">Learn More {{#assetContents arrow-right.svg}}</a>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
14
tpl/shop-sub-categories.tpl
Normal file
14
tpl/shop-sub-categories.tpl
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
<section class="category-sub-cats-wrapper">
|
||||||
|
<div class="container">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col">
|
||||||
|
|
||||||
|
<div class="sub-cats d-flex mb-5 gap-3">
|
||||||
|
{{#each children}}
|
||||||
|
{{#categoryBox this}}
|
||||||
|
{{/each}}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
67
vendor/open-function-computers-llc/rad-theme-engine/src/ActionsLoader.php
vendored
Normal file
67
vendor/open-function-computers-llc/rad-theme-engine/src/ActionsLoader.php
vendored
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace ofc;
|
||||||
|
|
||||||
|
use ReflectionClass;
|
||||||
|
|
||||||
|
class ActionsLoader
|
||||||
|
{
|
||||||
|
public static function load()
|
||||||
|
{
|
||||||
|
$actions_dir = get_template_directory() . '/actions';
|
||||||
|
|
||||||
|
if (!is_dir($actions_dir)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (scandir($actions_dir) as $file) {
|
||||||
|
if (pathinfo($file, PATHINFO_EXTENSION) !== 'php') {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$file_path = $actions_dir . '/' . $file;
|
||||||
|
require_once $file_path;
|
||||||
|
|
||||||
|
// Guess class name from file (assuming PSR-4 mapping matches)
|
||||||
|
// You can hardcode or use reflection if needed
|
||||||
|
$class_name = self::getClassFromFile($file);
|
||||||
|
|
||||||
|
if (!class_exists($class_name)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$reflection = new ReflectionClass($class_name);
|
||||||
|
|
||||||
|
if (!$reflection->isInstantiable()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$required_properties = ['hookName', 'priority'];
|
||||||
|
foreach ($required_properties as $prop) {
|
||||||
|
if (!$reflection->hasProperty($prop)) {
|
||||||
|
continue 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$reflection->hasMethod('callback')) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$instance = new $class_name();
|
||||||
|
|
||||||
|
if ($instance->wrapHookInInit()) {
|
||||||
|
add_action("init", function () use ($instance) {
|
||||||
|
add_action($instance->getHookName(), [$instance, 'callback'], $instance->getPriority());
|
||||||
|
}, $instance->getPriority());
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
add_action($instance->getHookName(), [$instance, 'callback'], $instance->getPriority());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static function getClassFromFile($file)
|
||||||
|
{
|
||||||
|
$class_base = pathinfo($file, PATHINFO_FILENAME);
|
||||||
|
return 'Actions\\' . $class_base;
|
||||||
|
}
|
||||||
|
}
|
||||||
27
vendor/open-function-computers-llc/rad-theme-engine/src/RadAction.php
vendored
Normal file
27
vendor/open-function-computers-llc/rad-theme-engine/src/RadAction.php
vendored
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace ofc;
|
||||||
|
|
||||||
|
abstract class RadAction implements RadActionInterface
|
||||||
|
{
|
||||||
|
protected string $hookName;
|
||||||
|
protected int $priority = 99;
|
||||||
|
protected bool $wrapInit = false;
|
||||||
|
|
||||||
|
public function getHookName(): string
|
||||||
|
{
|
||||||
|
return $this->hookName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getPriority(): int
|
||||||
|
{
|
||||||
|
return $this->priority;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function wrapHookInInit(): bool
|
||||||
|
{
|
||||||
|
return $this->wrapInit;
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract public function callback();
|
||||||
|
}
|
||||||
10
vendor/open-function-computers-llc/rad-theme-engine/src/RadActionInterface.php
vendored
Normal file
10
vendor/open-function-computers-llc/rad-theme-engine/src/RadActionInterface.php
vendored
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace ofc;
|
||||||
|
|
||||||
|
interface RadActionInterface
|
||||||
|
{
|
||||||
|
public function getHookName(): string;
|
||||||
|
public function getPriority(): int;
|
||||||
|
public function callback();
|
||||||
|
}
|
||||||
@@ -1097,10 +1097,37 @@ class Site
|
|||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function getTermChildren($term, $fields = [])
|
||||||
|
{
|
||||||
|
$args = [
|
||||||
|
'taxonomy' => $term->taxonomy,
|
||||||
|
'parent' => $term->term_id,
|
||||||
|
'hide_empty' => false,
|
||||||
|
'suppress_filter' => true,
|
||||||
|
];
|
||||||
|
$results = get_terms($args);
|
||||||
|
|
||||||
|
if ($fields == []) {
|
||||||
|
return $results;
|
||||||
|
}
|
||||||
|
|
||||||
|
$output = [];
|
||||||
|
foreach ($results as $term) {
|
||||||
|
$append = $this->getFieldsForTerm($fields, $term);
|
||||||
|
$output[] = $append;
|
||||||
|
}
|
||||||
|
return $output;
|
||||||
|
}
|
||||||
|
|
||||||
private function getFieldsForTerm(array $fields, $term)
|
private function getFieldsForTerm(array $fields, $term)
|
||||||
{
|
{
|
||||||
$output = [];
|
$output = [];
|
||||||
foreach ($fields as $key) {
|
foreach ($fields as $key) {
|
||||||
|
if (str_starts_with($key, "children")) {
|
||||||
|
$fields = explode(",", str_replace("children.", "", $key));
|
||||||
|
$output["children"] = site()->getTermChildren($term, $fields);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if ($key === "id" || $key === "ID" || $key === "term_id") {
|
if ($key === "id" || $key === "ID" || $key === "term_id") {
|
||||||
$output[$key] = $term->term_id;
|
$output[$key] = $term->term_id;
|
||||||
continue;
|
continue;
|
||||||
@@ -1131,7 +1158,14 @@ class Site
|
|||||||
$output[$key] = get_field($key, $term->taxonomy . "_" . $term->term_id);
|
$output[$key] = get_field($key, $term->taxonomy . "_" . $term->term_id);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// try to get the property straight off the object?
|
||||||
$output[$key] = $term->$key;
|
$output[$key] = $term->$key;
|
||||||
|
|
||||||
|
// still nothing? check meta
|
||||||
|
if (is_null($output[$key])) {
|
||||||
|
$output[$key] = get_term_meta($term->term_id, $key, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
@@ -1498,23 +1532,30 @@ class Site
|
|||||||
|
|
||||||
private function processActions()
|
private function processActions()
|
||||||
{
|
{
|
||||||
|
ActionsLoader::load();
|
||||||
|
|
||||||
if (!isset($this->config["actions"]) || !is_array($this->config["actions"])) {
|
if (!isset($this->config["actions"]) || !is_array($this->config["actions"])) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($this->config["actions"] as $hookName => $callback) {
|
foreach ($this->config["actions"] as $hookName => $action) {
|
||||||
if (is_array($callback) && array_is_list($callback)) {
|
if (is_array($action) && array_is_list($action) && count($action) === 2) {
|
||||||
$priority = $callback[1];
|
if (!is_numeric($action[1])) {
|
||||||
$callback = $callback[0];
|
// invalid priority
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$priority = $action[1];
|
||||||
|
$callback = $action[0];
|
||||||
add_action($hookName, $callback, $priority);
|
add_action($hookName, $callback, $priority);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (is_array($callback) && isset($callback["hook"]) && isset($callback["callback"])) {
|
|
||||||
add_action($callback["hook"], $callback["callback"], $callback["priority"] ?? 99);
|
if (is_array($action) && isset($action["hook"]) && isset($action["callback"])) {
|
||||||
|
add_action($action["hook"], $action["callback"], $action["priority"] ?? 99);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
add_action($hookName, $callback, 99);
|
add_action($hookName, $action, 99);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user