JCO Entry Catcount
Developer
3rd Party (Free)
EE Version Support
- ExpressionEngine 2
Compatibility
If an item is crossed out, it might be untested, not applicable or incompatible. Contact the developer to be sure.
- Updater
- Multi Site Manager
- Stand Alone Entry Form
- Low Variables
- Content Elements
- Better Workflow
- Matrix
- Grid
- Webservice
- Publisher
Requirements
- jQuery for the Control Panel
Add-On Type(s)
Plugin
Tags
Want to only display something based on the number of categories that is assigned to a particular entry? This small plugin grabs that number and allows you to use it in conditional statements.
This is an EE2 rewrite of the EE1 Entry Category Count plugin originally released by Erik Reagan. Credits for the original idea goes to him. I simply needed it for EE2.
Returns the number of categories for a given entry
Examples
Simple
{exp:jco_entry_catcount entry_id="3"}{nbrcategories}{/exp:jco_entry_catcount}
{exp:jco_entry_catcount entry_id="{entry_id}"}{nbrcategories}{/exp:jco_entry_catcount}
Limited to category group(s)
{exp:jco_entry_catcount entry_id="3" category_group_id="1"}{nbrcategories}{/exp:jco_entry_catcount}
{exp:jco_entry_catcount entry_id="3" category_group_id="1|2"}{nbrcategories}{/exp:jco_entry_catcount}
{exp:jco_entry_catcount entry_id="3" category_group_id="not 2"}{nbrcategories}{/exp:jco_entry_catcount}
Using Conditionals
{exp:jco_entry_catcount entry_id="{entry_id}"}
{if nbrcategories == 0}
No categories assigned to this entry
{/if}
{/exp:jco_entry_catcount}
{exp:jco_entry_catcount entry_id="{entry_id}"}
{if nbrcategories > 0}
Multiple categories assigned to this entry
{/if}
{/exp:jco_entry_catcount}
Parameters
entry_id=“1” : Mandatory
The id for the entry that you want to output the number of categories for
category_group_id=“1”: Optional
The id of the category group you want to limit the query to
You can use piped list: category_group_id=“1|2”
You can use not clause: category_group_id=“not 2”
JCO Entry Catcount Links
This entry was created July 14, 2011, 12:09 pm.
This entry was last updated January 19, 2012, 1:22 am.
Disclaimer: Information about ExpressionEngine add-ons is provided as a service to you, the user, and every member of the ExpressionEngine community. devot:ee is not responsible if you hose, mangle, wreck, or otherwise destroy your EE website by installing an add-on that you found out about at this site, regardless of its rating, Favorites status, commercial or free status, or general popularity. Caveat EEmptor!
Returns: devot:ee has a 30-day return policy on all commercial add-ons sold through devot-ee.com. If you need to return an add-on, do not go to the developer or the developer's site, but rather visit our returns page at https://devot-ee.com/returns to initiate your return. If you have questions, email support@devot-ee.com.
2 Reviews:
Jérôme Coupé 01.17.13
Duplicate queries fixed in version 1.2. Thanks for the heads up
EpicVoyage 08.27.12
Extremely useful, although the category_group_id parameter queries the database once per category.