Support » Plugins » Use hooks to wrap woocommerce content-product_cat in

  • I am simply trying to wrap the li element inside the woocommerce\templates\content-product_cat.php with a <div class=”content-wrapper”></div>. I have styles associated with the div class to allow the product category titles to hover over the category image instead of the default show beneath the category image. I can simply add the div tag to the woocommerce file but every time woocommerce updates the change is lost.

    My several hours of searching WordPress codex and forums has led me to try adding the following to my child function.php file:

    function shop_div_container($content){
    $content = ‘<div>$content</div>’;
    return $content;
    }
    add_filter(‘woocommerce_before_subcategory’, ‘shop_div_container’);

    This does not add anything to the source HTML. I also tried add_action, woocommerce_before_subcategory_title, just returning the opening <div> tag without the $content parameter and nothing seems to place the div around the li tag item.

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Use hooks to wrap woocommerce content-product_cat in’ is closed to new replies.