/** * (non-PHPdoc) * @see wp-includes/WP_Widget::widget() */ public function widget($args, $instance) { extract($args); $title = apply_filters('widget_title', empty($instance['title']) ? __('Brands', DH_DOMAIN) : $instance['title'], $instance, $this->id_base); $o = isset($instance['orderby']) ? $instance['orderby'] : 'order'; $h = $instance['hide_empty'] ? true : false; if ($o == 'name') { $order = 'asc'; } else { $order = 'desc'; } $brands = get_terms('product_brand', array('hide_empty' => $h, 'orderby' => $o, 'order' => $order)); if (!$brands) { return; } echo $before_widget; if ($title) { echo $before_title . $title . $after_title; } ?> <div class="product-brand-slide"> <ul id="pb-<?php echo $args['widget_id']; ?> " class="list-brand"> <?php foreach ($brands as $brand) { ?> <?php $thumbnail = dhwc_get_product_brand_thumbnail_url($brand->term_id); if (!$thumbnail) { $thumbnail = woocommerce_placeholder_img_src(); } ?> <li class="item"> <a title="<?php echo $brand->name; ?> " href="<?php echo get_term_link($brand->slug, 'product_brand'); ?> "> <img alt="<?php echo $brand->name; ?> " src="<?php echo $thumbnail; ?> "> </a> <h2><a title="<?php echo $brand->name; ?> " href="<?php echo get_term_link($brand->slug, 'product_brand'); ?> "><?php echo $brand->name; ?> </a></h2> </li> <?php } ?> </ul> </div> <script type="text/javascript"> <!-- jQuery(document).ready(function($){ $('#pb-<?php echo $args['widget_id']; ?> ').bxSlider(); }); //--> </script> <?php echo $after_widget; }
/** * show brand description */ function dhwc_show_product_brand_descs() { if (!is_tax('product_brand')) { return; } if (!get_query_var('term')) { return; } $thumbnail = ''; $term = get_term_by('slug', get_query_var('term'), 'product_brand'); $thumbnail = dhwc_get_product_brand_thumbnail_url($term->term_id, 'shop_catalog'); ?> <div class="term-description product-brand-desc"> <?php if ($thumbnail) { ?> <img src="<?php echo $thumbnail; ?> " /> <?php } ?> <div class="text"><?php echo wpautop(wptexturize(term_description())); ?> </div> </div> <?php }