'widget-categories widget_custom_categories', 'description' => __( 'Display Custom Categories.', 'becommerce-store' ) ); // Create the widget. parent::__construct( 'custom_categories', // $this->id_base __( '» BeCommerce Custom Categories', 'becommerce-store' ), // $this->name $becommerce_store_widget_options // $this->becommerce_store_widget_options ); } /** * Outputs the widget based on the arguments input through the widget controls. * * @since 1.0.0 */ function widget( $args, $instance ) { extract( $args ); // Output the theme's $before_widget wrapper. echo $before_widget; $instance = wp_parse_args( $instance, array( 'title' => '', 'orderby' => 'count', 'order' => 'desc', 'depth' => '1', 'show_count' => 0, 'item_per_row' => 2, ) ); echo $before_title; echo empty( $instance['title'] ) ? _e( 'Categories', 'becommerce-store' ) : apply_filters( 'widget_title', $instance['title'] ); echo $after_title; $_args = array( 'show_option_all' => '', 'orderby' => 'name', 'order' => 'ASC', 'style' => 'list', 'show_count' => 1, 'hide_empty' => 0, 'use_desc_for_title' => 1, 'child_of' => 0, 'feed' => '', 'feed_type' => '', 'feed_image' => '', 'exclude' => '', 'exclude_tree' => '', 'include' => '', 'hierarchical' => 1, 'title_li' => false, 'show_option_none' => false, 'echo' => 1, 'depth' => 1, 'current_category' => 0, 'pad_counts' => 0, 'walker' => new becommerce_store_Walker_Category() ); $_args = wp_parse_args( $instance , $_args ); ?>
'', 'orderby' => 'count', 'order' => 'desc', 'depth' => '1', 'show_count' => 0, 'item_per_row' => 2, ) ); $title = ! empty( $instance['title'] ) ? $instance['title'] : ''; ?>

'0 - ' . esc_html__( 'All Categories and child Categories', 'becommerce-store' ), '-1' => '-1 -' . esc_html__('All Categories displayed in flat (no indent) form (overrides hierarchical)', 'becommerce-store' ), '1' => '1 - ' . esc_html__( 'Show only top level Categories', 'becommerce-store' ), 'n' => 'n - ' . esc_html__( 'Value of n (a number) specifies the depth (or level) to descend in displaying Categories', 'becommerce-store' ), ); ?>

", $depth ); ?>

id="get_field_id( 'show_count' ); ?>" name="get_field_name( 'show_count' ); ?>" type="checkbox" value="1">

name ), $category ); // Don't generate an element if the category name is empty. if ( ! $cat_name ) { return; } $link = 'description ) ) { /** * Filter the category description for display. * * @since 1.2.0 * * @param string $description Category description. * @param object $category Category object. */ $link .= 'title="' . esc_attr( strip_tags( apply_filters( 'category_description', $category->description, $category ) ) ) . '"'; } $link .= '>'; $link .= $cat_name . ''; if ( ! empty( $args['show_count'] ) ) { $link .= ' (' . number_format_i18n( $category->count ) . ') '; } if ( 'list' == $args['style'] ) { $output .= "\tterm_id, ); if ( ! empty( $args['current_category'] ) ) { $_current_category = get_term( $args['current_category'], $category->taxonomy ); if ( $category->term_id == $args['current_category'] ) { $css_classes[] = 'current-cat'; } elseif ( $category->term_id == $_current_category->parent ) { $css_classes[] = 'current-cat-parent'; } } /** * Filter the list of CSS classes to include with each category in the list. * * @since 4.2.0 * * @see wp_list_categories() * * @param array $css_classes An array of CSS classes to be applied to each list item. * @param object $category Category data object. * @param int $depth Depth of page, used for padding. * @param array $args An array of wp_list_categories() arguments. */ $css_classes = implode( ' ', apply_filters( 'category_css_class', $css_classes, $category, $depth, $args ) ); $output .= ' class="' . $css_classes . '"'; $output .= ">$link\n"; } else { $output .= "\t$link
\n"; } } }