Changeset 1271743
- Timestamp:
- 10/23/2015 12:11:50 PM (10 years ago)
- Location:
- sf-category-menu/trunk
- Files:
-
- 2 edited
-
readme.txt (modified) (1 diff)
-
sf-category-menu.php (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
sf-category-menu/trunk/readme.txt
r1260202 r1271743 19 19 * Exclude categories 20 20 * Translation ready 21 * Doesn't show empty categories 21 22 22 23 = Live demo: = -
sf-category-menu/trunk/sf-category-menu.php
r1242718 r1271743 5 5 * Plugin URI: http://studiofreya.com/sf-category-menu/ 6 6 * Description: Easy treeview menu for WordPress categories. 7 * Version: 1. 27 * Version: 1.3 8 8 * Author: Studiofreya AS 9 9 * Author URI: http://studiofreya.com … … 36 36 } 37 37 38 function getSubCategoryPostCount( $catid )39 {40 $num = 0;41 42 $args = array(43 'type' => 'post',44 'parent' => "$catid",45 'orderby' => 'name',46 'order' => 'ASC',47 'hide_empty' => 1,48 'hierarchical' => 0,49 'exclude' => '',50 'include' => '',51 'number' => '',52 'taxonomy' => 'category',53 'pad_counts' => true54 );55 56 $categories = get_categories( $args );57 58 foreach($categories as $cat)59 {60 $num += $cat->count;61 62 $num += getSubCategoryPostCount($cat->cat_ID);63 }64 65 return $num;66 }67 68 38 function sf_doCategories( $categories, $select_style, $parent = 0 ) 69 39 { … … 88 58 $ID = $category->cat_ID; 89 59 $subcatcount = sf_getPostCount($ID); 60 61 if($subcatcount < 1) { 62 continue; 63 } 90 64 91 65 $category_link = esc_url( get_category_link( $category->term_id ) ); … … 102 76 "; 103 77 78 $hide_empty = 1; 79 80 if ( $parent == 1 ) { 81 $hide_empty = 0; 82 } 83 104 84 $childargs = array( 105 85 'parent' => $ID, 106 'hide_empty' => 1,86 'hide_empty' => $hide_empty, 107 87 'hierarchical' => 0, 108 88 'pad_counts' => true … … 138 118 'orderby' => 'name', 139 119 'order' => 'ASC', 140 'hide_empty' => 1,120 'hide_empty' => 0, 141 121 'hierarchical' => 0, 142 122 'exclude' => $exclude_categories,
Note: See TracChangeset
for help on using the changeset viewer.