GWcode Categories Examples
Here are some examples to demonstrate what you can do with GWcode Categories:
- Example 1 - Showing categories for an entry
- Example 2 - Showing last child categories only
- Example 3 - Showing categories of any (fixed, minimum or maximum) depth
- Example 4 - Showing the entry count for categories
- Example 5 - Category based breadcrumbs
- Example 6 - Automatic nested numbering
- Example 7 - Counting categories
- Example 8 - Conditionals
- Example 9 - Showing child categories or parent categories
- Example 10 - Sorting categories
- Example 11 - Creating a menu with specific code
Example 5 - Category based breadcrumbs
In this example, I'm creating a breadcrumb trail for an entry. The entry has been assigned to two categories: "ExpressionEngine" and its child category "GWcode Categories", which both belong to a category group named "Add-ons".
I want to be able to create a trail which looks like this: Home » Add-ons » ExpressionEngine » GWcode Categories » Overview.
This is what I would use in my template for the entry page:
{exp:channel:entries channel="add-ons" limit="1"}
<a href="{site_url}">Home</a> »
{exp:gwcode_categories entry_id="{entry_id}" style="linear"}
{if group_start}<a href="{path="add-ons"}">{cat_group_name}</a> »{/if}
<a href="{path="add-ons/{cat_url_title}"}">{cat_name}</a> »
{/exp:gwcode_categories}
{title}
{/exp:channel:entries}
