brand-description.php
1 year ago
brand-thumbnails-description.php
1 year ago
brand-thumbnails.php
1 year ago
brand-thumbnails-description.php
59 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Show a grid of thumbnails |
| 4 | * |
| 5 | * This template can be overridden by copying it to yourtheme/woocommerce/brands/widgets/brand-thumbnails-description.php. |
| 6 | * |
| 7 | * HOWEVER, on occasion WooCommerce will need to update template files and you |
| 8 | * (the theme developer) will need to copy the new files to your theme to |
| 9 | * maintain compatibility. We try to do this as little as possible, but it does |
| 10 | * happen. When this occurs the version of the template file will be bumped and |
| 11 | * the readme will list any important changes. |
| 12 | * |
| 13 | * @see https://woocommerce.com/document/template-structure/ |
| 14 | * @package WooCommerce\Templates |
| 15 | * @version 9.4.0 |
| 16 | */ |
| 17 | |
| 18 | declare( strict_types = 1); |
| 19 | ?> |
| 20 | <ul class="brand-thumbnails-description"> |
| 21 | |
| 22 | <?php |
| 23 | foreach ( $brands as $index => $brand ) : |
| 24 | |
| 25 | /** |
| 26 | * Filter the brand's thumbnail size. |
| 27 | * |
| 28 | * @since 9.4.0 |
| 29 | * @param string $size Defaults to 'shop_catalog' |
| 30 | */ |
| 31 | $thumbnail = wc_get_brand_thumbnail_url( $brand->term_id, apply_filters( 'woocommerce_brand_thumbnail_size', 'shop_catalog' ) ); |
| 32 | |
| 33 | if ( ! $thumbnail ) { |
| 34 | $thumbnail = wc_placeholder_img_src(); |
| 35 | } |
| 36 | |
| 37 | $class = ''; |
| 38 | |
| 39 | if ( 0 === $index || 0 === $index % $columns ) { |
| 40 | $class = 'first'; |
| 41 | } elseif ( 0 === ( $index + 1 ) % $columns ) { |
| 42 | $class = 'last'; |
| 43 | } |
| 44 | |
| 45 | $width = floor( ( ( 100 - ( ( $columns - 1 ) * 2 ) ) / $columns ) * 100 ) / 100; |
| 46 | ?> |
| 47 | <li class="<?php echo esc_attr( $class ); ?>" style="width: <?php echo esc_attr( $width ); ?>%;"> |
| 48 | <a href="<?php echo esc_url( get_term_link( $brand->slug, 'product_brand' ) ); ?>" title="<?php echo esc_attr( $brand->name ); ?>" class="term-thumbnail"> |
| 49 | <img src="<?php echo esc_url( $thumbnail ); ?>" alt="<?php echo esc_attr( $brand->name ); ?>" /> |
| 50 | </a> |
| 51 | <div id="term-<?php echo esc_attr( $brand->term_id ); ?>" class="term-description"> |
| 52 | <?php echo wp_kses_post( wpautop( wptexturize( $brand->description ) ) ); ?> |
| 53 | </div> |
| 54 | </li> |
| 55 | |
| 56 | <?php endforeach; ?> |
| 57 | |
| 58 | </ul> |
| 59 |