Custom System Messages
DataGrab
Publisher
Reading Time PRo
Simple Grids & Tables
Speedy
Template Tags
Advanced Categories is a fieldtype, and as such it works just like any other fieldtype in ExpressionEngine. The following examples assume you created a custom field with the label of "My Category Field", and the field template short name is {my_category_field}
Every Advanced Categories field is a tag pair, and even though it is a field, the tag pair functions almost exactly the same as the {categories}{/categories} tag pair from the {exp:channel:entries} tag (see ExpressionEngine docs).
1
{exp:channel:entries}
2
{title}
3
{my_category_field}
4
{category_id}
5
{category_name}
6
{category_image}
7
{category_description}
8
{category_group}
9
{my_custom_category_field_1}
10
{my_custom_category_field_2}
11
{path="path/to/category/page"}
12
{category_total_results} or {total_results}
13
{category_count} or {count}
14
{/my_category_field}
15
{/exp:channel:entries}
Copied!
This tag pair does not have support for the show or show_group parameters
Since it is also a fieldtype you have access to several tag modifiers:
{my_category_field:ids} This will list all the IDs of the categories chosen in the field separated by pipe. For example: 1|2|3. If only a single category is selected, then its output would be that category ID.
{my_category_field:url_titles} This will list all the IDs of the categories chosen in the field separated by pipe. For example: alpha|beta|charlie. If only a single category is selected, then its output would be that category ID.
{my_category_field:category_names} This will list all the IDs of the categories chosen in the field separated by pipe. For example: Alpha|Beta|Charlie. If only a single category is selected, then its output would be that category ID.
All tag modifiers above support the separator="," parameter where you can change the pipe separator to another character of your choice. For example{my_category_field:ids separator=","} will output 1,2,3
If you wanted to see if an entry is assigned to a category you can use a simple conditional:
1
{exp:channel:entries}
2
{title}
3
{if my_category_field:ids ~ "/(1|2|3)/"}
4
This entry is assigned to either category 1, 2 or 3
5
{/if}
6
{/exp:channel:entries}
Copied!
Copy link