categories hierarchical FIX
-
function wsp_return_content_type_categories( $is_title_displayed=true, $display_nofollow=false, $sort=null,$cat=0,$return=false ) { // init $return = ''; // args $args = array(); $args['parent'] = $cat; // change the sort order if ($sort!==null) { $args['orderby'] = $sort; } // Get the categories $cats = get_categories( $args ); // check it's not empty if (empty($cats)) { return ''; } // display a nofollow attribute ? $attr_nofollow = ($display_nofollow==true ? ' rel="nofollow"' : ''); // add content if ($is_title_displayed==true && $cat == 0) { $return .= '<h4 class="wsp-categories-title">'.__('Categories', 'wp_sitemap_page').'</h4>'."\n"; } $return .= '<ul class="wsp-categories-list">'."\n"; foreach ($cats as $cat) { $return .= "\t".'<li><a href="'.get_category_link($cat->cat_ID).'"'.$attr_nofollow.'>'.$cat->name.'</a></li>'."\n"; $return .= wsp_return_content_type_categories($is_title_displayed,$display_nofollow,$sort, $cat->term_id,$return); } $return .= '</ul>'."\n"; // return content return apply_filters( 'wsp_categories_return', $return ); }
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘categories hierarchical FIX’ is closed to new replies.