Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Custom categories listing Walker
- class Post_Categories_Grid extends Walker_Category {
- // Displays start of a level. E.g '<ul>'
- // @see Walker::start_lvl()
- public function start_lvl(&$output, $depth=0, $args=array()) {
- $output .= "\n<ul class='row'>\n";
- }
- // Displays end of a level. E.g '</ul>'
- // @see Walker::end_lvl()
- public function end_lvl(&$output, $depth=0, $args=array()) {
- $output .= "</ul>\n";
- }
- // Displays start of an element. E.g '<li> Item Name'
- // @see Walker::start_el()
- public function start_el(&$output, $category, $depth=0, $args=array()) {
- $link = esc_url( get_term_link( $category ) );
- $image = "<img src='".cfi_featured_image_url( array( 'size' => 'medium', 'cat_id'=>$category->term_id ) )."' />";
- $output .= "<li class='product col-xs-6 col-md-4'><a href='$link' >$image<h3>".strtoupper(esc_attr($category->name));
- }
- // Displays end of an element. E.g '</li>'
- // @see Walker::end_el()
- public function end_el(&$output, $category, $depth=0, $args=array()) {
- $output .= "<mark class='count'>(".esc_attr($category->count).")</mark></h3></a></li>\n";
- }
- }
- function estlita_category_list($args = array()){
- $categories = get_the_category();
- $category_id = $categories[0]->cat_ID;
- $args = array(
- 'show_count'=>true,
- 'exclude'=>'1',
- 'depth'=>1,
- 'use_desc_for_title'=>true,
- 'style'=>'',
- 'child_of'=>$category_id,
- 'walker'=> new Post_Categories_Grid()
- );
- echo "<ul class='products row'>";
- wp_list_categories($args);
- echo "</ul>";
- }
Advertisement
Add Comment
Please, Sign In to add comment