Codex

Function Reference/get category parents

Contents

Description

Returns a list of the parents of a category, including the category, sorted by ID.

Usage

 <?php echo(get_category_parents(categorydisplay linkseparatornice name)); ?> 

Example

Returns the parent categories of the current category with links separated by '»'

<?php echo(get_category_parents($cat, TRUE, ' &raquo; ')); ?>

will output:

Internet » Blogging » WordPress »

Parameters

category 
(integer) The numeric category ID for which to return the parents. Defaults to current category, if one is set.
display link 
(boolean) Creates a link to each category displayed.
separator 
(string) What to separate each category by.
nice name 
(boolean) Return category nice name or not (defaults to FALSE).

Related

the_category, the_category_rss, single_cat_title, category_description, wp_dropdown_categories, wp_list_categories, get_the_category, get_category_parents, get_category_link, is_category, in_category

See also index of Function Reference and index of Template Tags.