diff --git a/inc/related-content.php b/inc/related-content.php index bab039e71..d0d8fa3af 100644 --- a/inc/related-content.php +++ b/inc/related-content.php @@ -4,52 +4,58 @@ * Show related tags and subcategories for each main category * Used on category.php to display a list of related terms * - * @since 1.0 + * @since 0.5.5 + * @return String HTML '' if there are no related topics or a UL if there are related topics */ function largo_get_related_topics_for_category( $obj ) { - $MAX_RELATED_TOPICS = 5; + $MAX_RELATED_TOPICS = 5; - if (!isset($obj->post_type)) { - $obj->post_type = 0; - } + if (!isset($obj->post_type)) { + $obj->post_type = 0; + } - if ( $obj->post_type ) { - if ( $obj->post_type == 'nav_menu_item' ) { - $cat_id = $obj->object_id; - } + if ( $obj->post_type ) { + if ( $obj->post_type == 'nav_menu_item' ) { + $cat_id = $obj->object_id; + } + } else { + $cat_id = $obj->cat_ID; + } - }else { - $cat_id = $obj->cat_ID; - } + // spit out the subcategories + $outarray = array(); + $cats = _subcategories_for_category( $cat_id ); - $out = "