This snippet adds subcategories to the menu.
<?php
function wpd_archive_menu() { #($current_menu_item)
$parentCat = get_queried_object_id();
$cats = get_categories(array(
'parent' => $parentCat,
'taxonomy' => 'product_cat',
'hide_empty' => 1,
'number' => 18
));
ob_start();
?>
<div class="product_submenu archive-top-menu archive-top-menu-mobile">
<?php
foreach ($cats as $index => $cat){
?>
<div class="product_submenu_category product_submenu_category_mobile" data-subcatnumber="<?php echo $index/*count($cats_hide_empty)*/?>" data-hidecat="<?= $cat->count == 0?>">
<div class="product_submenu_category_links product_submenu_category_links_mobile">
<?php
$title_class = null;
$cat_thumb_id = get_term_meta( $cat->term_id, 'thumbnail_id', true );
$shop_catalog_img = wp_get_attachment_image_src( $cat_thumb_id, 'medium' );
//var_dump($shop_catalog_img);
if ($shop_catalog_img) {
$title_class = "image";
}
?>
<a class="<?php echo $title_class ?>" href="<?php echo get_category_link($cat->term_id)?>">
<?php
if ($shop_catalog_img) {
?>
<div class="archive-menu-image archive-menu-image-mobile">
<div class="archive-mega-image" style="background-image: url(<?php echo $shop_catalog_img[0] ?>)" ></div>
</div>
<?php
}
?>
<div class="title">
<h5 class="cat_name_mobile <?php echo $title_class ?>"><?php echo $cat->name?></h5>
</div>
</a>
</div>
</div>
<?php
}
?>
</div>
<?php
return ob_get_clean();
}
add_shortcode('archive-menu', 'wpd_archive_menu');
Cookie | Duration | Description |
---|---|---|
__stripe_mid | 1 year | Stripe sets this cookie cookie to process payments. |
__stripe_sid | 30 minutes | Stripe sets this cookie cookie to process payments. |
cookielawinfo-checkbox-advertisement | 1 year | Set by the GDPR Cookie Consent plugin, this cookie is used to record the user consent for the cookies in the "Advertisement" category . |
cookielawinfo-checkbox-analytics | 11 months | This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Analytics". |
cookielawinfo-checkbox-functional | 11 months | The cookie is set by GDPR cookie consent to record the user consent for the cookies in the category "Functional". |
cookielawinfo-checkbox-necessary | 11 months | This cookie is set by GDPR Cookie Consent plugin. The cookies is used to store the user consent for the cookies in the category "Necessary". |
cookielawinfo-checkbox-others | 11 months | This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Other. |
cookielawinfo-checkbox-performance | 11 months | This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Performance". |
elementor | never | This cookie is used by the website's WordPress theme. It allows the website owner to implement or change the website's content in real-time. |
viewed_cookie_policy | 11 months | The cookie is set by the GDPR Cookie Consent plugin and is used to store whether or not user has consented to the use of cookies. It does not store any personal data. |
Cookie | Duration | Description |
---|---|---|
_gh_sess | session | GitHub sets this cookie for temporary application and framework state between pages like what step the user is on in a multiple step form. |
Cookie | Duration | Description |
---|---|---|
_octo | 1 year | No description available. |
logged_in | 1 year | No description available. |
m | 2 years | No description available. |
TDPrJV | 1 day | No description |
wNiYbt | 1 day | No description |