GWcode Categories

http://gwcode.com/assets/img/add-ons/tn/gwcode-categories.gif

This MSM compatible plugin for ExpressionEngine 1 & 2 allows you to list your categories (nested or linear) based on certain conditionals, such as a minimum depth, maximum depth or fixed depth. It can be used to easily display a category based dynamic breadcrumbs trail for example, or a category's child categories.

ExpressionEngine categories are very flexible. Within a category group, you're able to create a nested set of categories, meaning that a category could have a parent category and one or more child categories. And, each of those child categories could have it's own list of child categories. Entries can be assigned to one or more categories (from one or more category groups) of any depth.

While all this flexibility is great, it also makes things a bit complex when working with categories. Plus, some things are impossible to achieve without using an add-on or custom sql queries.

The solution

This is where the GWcode Categories plugin comes in handy!

  • It's Multi Site Manager (MSM) compatible, a site_id parameter can be used.
  • It's efficient and fast, it only took 0.0022 seconds on my server to display a list of 34 categories with their number of entries next to it and a minor 0.0008 seconds to display a category's child categories.
  • It keeps the order of the categories the same as in your CP, but can also be overridden using the orderby and sort parameters.
  • It's free, despite the many hours spent developing and testing!

How it works

You basically pick a starting point first to get a list of categories and then narrow it down by choosing from a wide variety of parameters.
Your starting point can be:

  • One or more channels by using the channel parameter (to get the categories for those channels);
  • One or more category groups by using the group_id parameter (to get the categories for those category groups);
  • One or more entries by using the entry_id parameter (to get the categories the entry has been added to, or, when providing multiple entry id's, to create a list of (unique) categories for those entries);
  • A category by using the cat_id or cat_url_title parameter (to get its child categories, or parent categories).

Then if needed, you can narrow down the resulting list of categories to get what you want, by using parameters such as depth, last_only, show_empty, excl_cat_id, etc.

What you can do

Here's a quick list of what you can achieve with this plugin. You can find some of these on the examples page.

  • Show all categories or categories with a fixed depth, minimum depth or maximum depth for one or more channels, and entry, or one or more category groups.
  • Show the categories (or specific categories) an entry has been added to. You can use this to create a category based breadcrumb trail for example.
  • Show only last child categories for one or more channels, an entry, or one or more category groups.
  • Count the number of categories for one or more channels, an entry, or one or more category groups.
  • Show the number of entries (with or without a certain status) in a category. Or create a list of categories with their number of entries.
  • Show a category's child categories. Or its parents so it could function as a breadcrumb trail.
  • Create a "most popuplar" categories list, which is ordered by the number of entries that have been added to those categories.