Skip to content

ExpressionEngine plugin output information about the currently viewed category.

Notifications You must be signed in to change notification settings

a-digital/category-relatives

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

category-relatives

ExpressionEngine plugin output information about the currently viewed category.

This is a single tag which requires parameters for category and category_group. Category Group is required as EE allows categories to share the same name and url_title, so this additional parameter avoids any ambiguity. It would most likely be used in conjunction with http://gwcode.com/add-ons/gwcode-categories which provides greater access to the category tree than the native channel categories tag.

If Structure is being used with Zoo Triggers, the category will need to be extracted using the {triggers:segment_x} tag. Otherwise, the normal {segment_x} tag can be used depending on the location within the category URL structure.

The tag outputs the following:

-- Number of children beneath the current category: {exp:category_relatives:count_children category="{triggers:segment_4}" category_group="2"}

Output: eg. 6

-- Whether the current category has a parent: {exp:category_relatives:has_parent category="{triggers:segment_4}" category_group="2"}

Output: eg: 12. NB. This isn't a boolean output, but the category ID of the current parent. A category with no parent will have a parent_id of 0.

-- The title of the parent category: {exp:category_relatives:parent_name category="{triggers:segment_4}" category_group="2"}

Output: eg. Food and Drink

About

ExpressionEngine plugin output information about the currently viewed category.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages