Template Tags/get category parents
Материал из WordPress Wiki
Содержание |
Description
Returns a list of the parents of a category, including the category, sorted by ID.
Usage
%%% <?php echo(get_category_parents(category, display link, separator, nice name)); ?> %%%
Example
Returns the parent categories of the current category with links separated by '»'
<?php echo(get_category_parents($cat, TRUE, ' » ')); ?>
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).