The purpose of this plugin is to display a list of subcategories for a given category.
PARAMETERS (All optional):
1) parent - specify parent category id number.
You can stack parent categories using pipe character e.g. parent=“3|16|28”.
2) sibling - specify child category id number
(plugin will find parent category and other child categories).
Either “parent” or “sibling” parameter MUST BE defined.
3) weblog - specify weblog name. Pipeline character and “not” are supported.
4) site - specify site id number.
5) child_categories_sort_by - specify sort order
of child categories. This parameter accepts three values: “name” (child
categories will be sorted by name), “id” (child categories will be sorted
by id number), and “custom” (child categories will be sorted using custom order
as defined in control panel). Default value is “name”.
6) child_categories_sort_direction - This parameter accepts two values: “asc” and “desc”. Default value is “asc”.
7) show_empty - specify if child categories having no
entries should be displayed or not. This parameter accepts two values: “yes” and “no”.
Default value is “no”.
8) entries_sort_by - specify sort order of entries.
This parameter accepts two values: “title” and “date”. Default value is “date”.
9) entries_sort_direction - specify sort direction
of entries. This parameter accepts two values: “asc” and “desc”.
Default value is “desc”.
10) entries_limit - specify how many entries posted into
child category should be displayed. This parameter accepts as its value an integer
or “none”. Default value is “10”. Value “none” means that all entries will be
displayed.
11) date_format - specify PHP date format string
(Not ExpressionEngine’s date format string!). Default value is “Y-m-d”.
12) show_expired - If the value is “yes”, expired entries will be counted; if the value is “no”, expired entries will not be counted. Default is “yes”.
13) status - specify status of entries. “not” and pipe characters are supported.
14) invalid_input - If the value is “alert”, then in cases when some parameter’s value is invalid plugin exits and PHP alert is being shown; if the value is “silence”, then such in cases plugin finishes its work without any alert being shown. Set this parameter to “alert” for development, and to “silence” - for deployment. Default is “silence”.
VARIABLE PAIRS:
1) {parent_category_start}{parent_category_end} - Allows you to specify portion of
code which will be iterated as many times as there are parent categories.
Single variables available for use inside this variable pair:
{parent_category_id}
{parent_category_name}
{parent_category_url_title}
{parent_category_description}
{parent_category_image}
{parent_category_children_count}
2) {child_category_start}{child_category_end} - Allows you to specify portion of
code which will be iterated as many times as there are child categories.
Single variables available for use inside this variable pair:
{parent_category_id}
{parent_category_name}
{parent_category_url_title}
{parent_category_description}
{parent_category_image}
{parent_category_children_count}
{child_category_id}
{child_category_name}
{child_category_url_title}
{child_category_description}
{child_category_image}
{child_category_order_num} - outputs number used for custom ordering of categories.
{entries_total}
3) {entries_start}{entries_end} - Use it to specify portion of
code which will be iterated as many times as there are entries posted into child
category. Single variables available for use inside this variable pair:
{parent_category_id}
{parent_category_name}
{parent_category_url_title}
{parent_category_description}
{parent_category_image}
{parent_category_children_count}
{child_category_id}
{child_category_name}
{child_category_url_title}
{child_category_description}
{child_category_image}
{child_category_order_num}
{entries_total}
{weblog_name}
{weblog_short_name}
{weblog_url}
{title}
{url_title}
{entry_date}
{count}
4) {entries_wrapper_top_start}{entries_wrapper_top_end} - specify top part of the code with which you want to wrap output of {entries_start}{entries_end} variable pair.
5) {entries_wrapper_bottom_start}{entries_wrapper_bottom_end} - specify bottom part of the code with which you want to wrap output of {entries_start}{entries_end} variable pair.
6) {child_wrapper_bottom_start}{child_wrapper_bottom_end} - specify bottom part of the code with which you want to wrap all data of child category.
7) {parent_wrapper_bottom_start}{parent_wrapper_bottom_end} - specify bottom part of the code with which you want to wrap all data of parent category.
The tag {exp:child_categories} MUST contain at least one variable pair out of
{parent_category_start}{parent_category_end}, {child_category_start}{child_category_end} and {entries_start}{entries_end} variable pairs and each single variable MUST BE inside relevant variable pair.
EXAMPLE OF USAGE:
{exp:child_categories parent="18|29" child_categories_sort_by="custom" child_categories_sort_direction="asc" show_empty="yes" entries_sort_by="date" entries_sort_direction="asc" entries_limit="3" site="1"}
{parent_category_start}
<h1><a href="{homepage}/category/{parent_category_url_title}/">{parent_category_name}</a></h1>
{parent_category_end}
{child_category_start}
<h2><a href="{homepage}/category/{child_category_url_title}/">{child_category_name}</a></h2>
Total entries: {entries_total}<br>
{child_category_end}
{entries_wrapper_top_start}<ul>{entries_wrapper_top_end}
{entries_start}
<li><a href="{weblog_url}{url_title}/">{title}</a> Weblog: {weblog_name}, posted: {entry_date}</li>
{entries_end}
{entries_wrapper_bottom_start}</ul>{entries_wrapper_bottom_end}
{/exp:child_categories}
