single category display in single div storefront woo commerce

Viewed 15

I would like to display a single product category in a single div on home page. I have 5 divs so I would like 5 different product categories to be displayed in a specific div. What am I doing wrong in the code?

function custom_show_cetgory_home () {
<?php if( is_category( 'camicie-e-magliette' ) ) {
    echo ('<div class="product-category-1">');
    } else if( is_category( 'abiti-e-vestiti' ) ) {
        echo ('<div class="product-category-2">');
    } else if( is_category( 'borse-e-accessori' ) ) {
        echo ('<div class="product-category-3">');
    } else if( is_category( 'giacche-donna' ) ) {
        echo ('<div class="product-category-4">');
    } else if( is_category( 'atelier' ) ) {
        echo ('<div class="product-category-5">');
    }; ?>
}

add_action( 'init', 'custom_show_cetgory_home' );
0 Answers
Related