Last active
January 26, 2019 17:54
-
-
Save aslamahamed13/ee311de6826d675d74e1c27091bc8114 to your computer and use it in GitHub Desktop.
Electro - home-v6 icon as image carousel
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if ( ! function_exists( 'electro_home_category_icon_carousel' ) ) { | |
function electro_home_category_icon_carousel( $args, $carousel_args ) { | |
$args = wp_parse_args( $args ); | |
$carousel_args = wp_parse_args( $carousel_args ); | |
$args['carousel_args'] = $carousel_args; | |
$categories = get_terms( 'product_cat' ); | |
extract( $args ); | |
if ( is_woocommerce_activated() ) { | |
?><section class="<?php echo esc_attr( $section_class ); ?>" <?php if ( ! empty( $animation ) ) : ?>data-animation="<?php echo esc_attr( $animation ); ?>"<?php endif; ?>> | |
<div id="<?php echo esc_attr( $carousel_id );?>" data-ride="owl-carousel" data-replace-active-class="true" data-carousel-selector=".categories-carousel" data-carousel-options="<?php echo esc_attr( json_encode( $args['carousel_args'] ) ); ?>"> | |
<div class="categories-carousel owl-carousel"> | |
<?php foreach( $categories as $category ) : ?> | |
<?php $icon = get_term_meta( $category->term_id, 'icon', true ); ?> | |
<div class="category"> | |
<a href="<?php echo esc_url( get_term_link( $category ) ); ?>"> | |
<div class="media-img"><?php woocommerce_subcategory_thumbnail( $category ); ?></div> | |
<div class="category-title"> | |
<h4 class="title"><?php echo esc_html( $category->name ); ?></h4> | |
</div> | |
</a> | |
</div> | |
<?php endforeach; ?> | |
</div> | |
</div> | |
</section><?php | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.page-template-template-homepage-v6 .categories-carousel .media-img img { | |
width: 100px; | |
margin: auto; | |
margin-bottom: 20px; | |
} | |
.page-template-template-homepage-v6 .categories-carousel .category-title .title { | |
font-size: 14px; | |
color: #333e48; | |
text-align: center; | |
line-height: 1.5; | |
font-weight: 600; | |
} | |
.page-template-template-homepage-v6 .categories-carousel .owl-nav { | |
display: block; | |
} | |
.page-template-template-homepage-v6 .categories-carousel .owl-nav .owl-prev { | |
top: calc(50% - 20px); | |
} | |
.page-template-template-homepage-v6 .categories-carousel .owl-nav .owl-next { | |
top: calc(50% - 20px); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment