Feature Request: Works with Category Names On. :cheese:
It’s a bit of a workaround, but you can do this using snippets: Pass the category_id to a template containing the subcategories plugin and place it in the plugin’s root_node parameter. For example:
Main template:
{exp:snippets template="template-group/subcategories-template"}
{thiscat}{exp:weblog:category_heading weblog="weblog1"}{category_id}{/exp:weblog:category_heading}{/thiscat}
{/exp:snippets}
subcategories-template template:
<h3>
{exp:subcategories root_node="%thiscat%"}
<a href="http://{path=something}{category_name}">{category_name}</a>,
{/exp:subcategories}
</h3>
Can this plug-in be nested within itself?
For instance, can you do this?
{exp:subcategories root_node="14" sort_by="category_id"}
<a href="http://{path=weblog/index}">{category_name}</a> - category id is {category_id}
{exp:subcategories root_node="{category_id}"}
the category_id passed is {category_id}
<a href="http://{path=weblog/index}">{category_name}</a>
{/exp:subcategories}
{/exp:subcategories}
The first level works and spits out what I want. And I can see that it has the correct ID being passed to the nested version; however, it stops working at this point. Any ideas?
Hi, this is an awesome plugin! I spent ages trying to figure out a way to do exactly this. I don’t know why it’s not already an official included plugin? I have one question though. Is it possible to show child categories, if they exist, beneath the “root_node”?
for example, categories are set as below:
Fruit (#1) - Apple (#2) – Russett (#5) – Cox (#6) - Orange (#3) - Banana (#4)
setting {root_node} as “1” will currently show:
Apple Orange Banana
but is it possible to show:
Apple - Russett - Cox Orange Banana
??
Unless I am doing something wrong, the subcategories plugin can’t display the category_description. Am I correct?
I am looking for a way to simply display:
Subcategory1ofTheCurrentlyViewedCategory Category description of subcategory1
Subcategory2ofTheCurrentlyViewedCategory Category description of subcategory2
etc.
I can’t do this with the dyno_cat plugin because, even though it does show category_descriptions, it won’t limit itself to only subcategories in the currently viewed category.
The subcategories plugin can limit itself but won’t apparently display descriptions.
What variable are you using? I just took a peek in the code, and it looks like the plugin should replace {cat_description} with the category description.
Neither cat_description nor category_description appear to work.
Here is my code:
{exp:subcategories}
<a href="http://{path=weblogname/templatename}C{category_id}">{category_name}</a>
{category_description}
{/exp:subcategories}
This outputs:
Subcategory {category_description}
Subcategory {category_description}
etc. That is, the description tag is not being processed.
Thank you, solar
Hi everyone, I have a question regarding this plugin, and actually EE in general.
Would someone be willing to offer up some custom code, if this isn’t that hard to achieve? I’m pretty certain that EE doesn’t offer this right out of the box.
Ok, so I’ve got a Restaurants page that displays all the different subcategories of restaurants (Mexican Food, Chinese Food). Instead of one big long list, I’d like to have three lists/columns.
Here is the logic that would need to take place.
Count the total number of subcategories. Divide that number by 3. Then loop through and create a list 3 separate times. For example, lets say there are 30 subcategories. I would need it to repeat the following code three times, looping through 10 times each, each one picking up where the other left off. The first would display 1-10, then 11-20, then 21-30.
<ul>
{exp:subcategories root_node="9" count_entries_from_weblogs="4"}
<li><a href="http://zipeye.com/business/listing/{category_name}">{category_name} - <span>{entries_count}</span></a></li>
{/exp:subcategories}
</ul>
Is this possible? Has anyone ever ran into this problem before? It seems like a lot of headache just to achieve a “column” effect, but the client really wants it.
Has anyone used this plug-in recently? I’ve been trying to get it to work for hours now and I can’t seem to get it to give me anything but a MySQL Error. Does it work with the latest version of EE?
I really need to just display the child categories, without having to use the whole show=”not 10” malarkey. That poses future problems. I can’t for the life of me figure out why we can show ‘parent only’ but not have the option to do ‘child only’.
Anyway, I’m not quite sure how to put together a query to do what I want and I was hoping this plug-in was the ticket. Anyone have any recent luck with it? Maybe I’m just missing something…
Thaaaaaank you. 😊
Joelle, Did you ever figure this out re how to display just child categories of parent X? I’m in the same boat and don’t want to hard code which children to show, since the client will be adding more over time. I got things to list correctly using a query, but then when you click on the link of the subchild to view its entries, it loses the category_id, since used cat_id for the query. So close, but yet so far!
Thanks,
Paula
Yes, it’s helpful hearing what finally worked. I’d thought about just using a category group instead, and wondered if there any limitations to that approach? I’m trying to get the lay of the land…like if you go to display categories that are assigned to multiple blogs, don’t you only get the entries related to that category for the one particular blog you’re in? (i.e., the categories are a handy naming convention to tag content, but not necessarily retrieve ALL content from multiple blogs with that tag?)
If so, seems chunking them into so many groups wouldn’t really affect their availability in different blogs…if you needed ALL the categories in their unchunked glory, you’d just (EDIT:) assign multiple groups to the blog.
Thanks for the quick response! It’s helpful when it arrives when you’re still freshly mired in the problem.
Paula
Joelle,
when you say you got it working using category groups do you mean that you abandoned the subcategories plugin and reworked it using the categiry groups (in which case how doyou get the category group name variable?) or do you mean that you used the subcategories plugin to extract the category group names?
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.