function sp_get_category_parents($id, $link = FALSE, $separator = '/', $nicename = FALSE) { $chain = ''; $parent =& get_category($id); if (is_wp_error($parent)) { return $parent; } if ($nicename) { $name = $parent->slug; } else { $name = $parent->cat_name; } if ($parent->parent && $parent->parent != $parent->term_id) { $chain .= get_category_parents($parent->parent, true, $separator, $nicename); } $chain .= bold_or_not($name); return $chain; }
function yoast_get_term_parents($id, $term_type = 'category', $link = FALSE, $separator = '/', $nicename = FALSE) { $chain = ''; $category = get_term($id, $term_type, $output, $filter); if (is_wp_error($category)) { return $category; } _make_cat_compat($category); $parent = $category; if (is_wp_error($parent)) { return $parent; } if ($nicename) { $name = $parent->slug; } else { $name = $parent->cat_name; } $term_child = get_term_children($id, $term_type); if ($parent->parent && $parent->parent != $parent->term_id) { $chain .= '<a href="' . get_term_link($parent->parent, $term_type) . '">' . yoast_get_term_parents($parent->parent, $term_type, true, $separator, $nicename) . '</a>' . $separator; } $chain .= bold_or_not($name); return $chain; }