php - how to set html layout in loop -
i want set html layout view in loop multiple categories. html code here...there many of categories came (wp-admin) woocommerce. given code layout of how show categories in home.php
want add more categories in home.php
through loop.thanks html code far...
<div class="selected-products-wrapper clearfix"> <div class="category-list"> <span class="category-main" style="background-color: #5d973e"> <div class="category-main_logo"> <img src="" alt="" class="v-middle"></div> <span class="category-main-title"> <a href="<?php echo get_term_link($cat->slug, 'product_cat'); ?>"> <?php echo $cat->name; ?></a></span> <div class="category-main-yakataheader"><img src=""></div> </span> <ul class="sub-category-list"> <li><a href="#"><?php echo $sub_category ->name; ?></a></li> </ul> <a href="#" class="view-all">view all</a> </div> <div class="images-list"> <a href="" class="large-img"> <img src="" alt="confectionery" class="v-middle lazy-img" height="351" width="290"> </a> <span class="small-img-block"> <a href=""> <img src="" alt="fruits & veggies" class="v-middle lazy-img" height="175" width="171"> </a> <a href=""> <img src="" alt="noodles" class="v-middle lazy-img" height="175" width="171"> </a> </span> <span class="center_img-block"> <a href=""> <img src="" alt="oats" class="v-middle lazy-img" height="175" width="344"> </a> <a href=""> <img src="" alt="ofada" class="v-middle lazy-img" height="175" width="344"> </a> </span> <span class="small-img-block last-img-block"> <a href=""> <img src="" alt="cooking oils" class="v-middle lazy-img" height="175" width="171"> </a> <a href=""> <img src="" alt="seasoning" class="v-middle lazy-img" height="175" width="171"> </a> </span> </div> <div class="alt-images-block"> <a href="">fruits & veggies</a> <a href="">noodles</a> <a href="">cooking oils</a> <a href="">seasoning</a> </div> </div>
you need create custom php function data want repeat.
e.g.
<?php function repeat_category(){ ?> //your html code want repeat goes here. <?php } ?>
then can use
<?php repeat_category(); ?>
wherever want html code appear.
Comments
Post a Comment