Thanks for looking at this, and I can’t say thanks enough for your work on the plug in, even if it doesn’t work in this scenario, it really does help in other ones.
The a href isn’t right yet, I haven’t been fooling with that because I didn’t want to have segment variables be another confusing factor while debugging.
This does what it’s supposed to, produces each of the parent categories and their subcategories below them. The problem is I have no idea how to tie the UL to the parent and then make the child a li.ul .
<div id="leftcolumn">
<div id="leftdropdown">
{exp:weblog:categories show="4|5|6|7|8|9" weblog="products"}
<h3>{category_name}</h3>
{exp:child_categories parent="{category_id}" child_categories_sort_by="custom"}
{child_category_start}
<li><a href="http://{homepage}/{site_group}/{child_category_url_title}/">{child_category_name}</a></li>
{child_category_end}
{/exp:child_categories}
{/exp:weblog:categories}
</div>
</div>
Hi Luc,
Try to add double quotes around both {child_category_url_title} and {segment_4} and avoid white space after {segment_4}:
{exp:child_categories category_group="3"}
{parent_category_start}
<h2>{parent_category_name}</h2>
<ul class="filter">
{parent_category_end}
{parent_wrapper_bottom_start}</ul>{parent_wrapper_bottom_end}
{child_category_start}
<li {if "{child_category_url_title}"=="{segment_4}"}class="selected"{/if}><a href="http://{homepage}gallery/view/category/{child_category_url_title}/">{child_category_name}</a></li>
{child_category_end}
{/exp:child_categories}
Hi Omma,
Read my post here - there you will find example code showing how to tie parents and children to UL and LI elements.
Hi vnystad,
Currently it is not possibble to order child categories at first by weblog the by some other criterion.
If you needed to order entries posted into child categories at first by weblog then by some other criterion (date or title) by using together Child Categories plugin and Entries List plugin.
Hi,
Great plugin, thank you.
I’m just having trouble dynamically assigning the parent ID.
I’m using the {exp:weblog:entries} and {categories} tags as well as PHP to get the last category ID of the entry, however when I try assign this to the {exp:child_categories} tag, it returns all the parent categories (and not the sub-categories of the parent). When I use an actual value (and not a variable) it works well.
Please find below the code:
{exp:weblog:entries weblog=landing_page}
{categories}
<?php
$category_id = "{category_id}";
?>
{/categories}
{/exp:weblog:entries}
<ul>
{exp:child_categories parent="<?= $category_id ?>" show_empty="yes"}
{child_category_start}
<li><a href="http://{parent_category_url_title}/{child_category_url_title}">{child_category_name}</a></li>
{child_category_end}
{/exp:child_categories}
</ul>
Any advice would be helpful.
Hi Jason,
Try this code:
<ul>
{exp:weblog:entries weblog="landing_page" parse="inward"}
{categories}
{exp:child_categories parent="{category_id}" show_empty="yes"}
{child_category_start}
<li><a href="http://{parent_category_url_title}/{child_category_url_title}">{child_category_name}</a></li>
{child_category_end}
{/exp:child_categories}
{/categories}
{/exp:weblog:entries}
</ul>
Currently it is not possibble to order child categories at first by weblog the by some other criterion.
OK, thanks anyway, I found a solution that seems to work - although I had to use a few extra lines of code. I’m building a project now that relies heavily on your plug-ins by now, Child Categories has certainly opened a few doors - I’ve never been happy with the way categories works out of the box with Expressionengine. I’m using Child Categories together with Find and Replace Plus to output JSON formatted data, and need to remove a comma after the last entry - but there is no backspace parameter. Is this something you plan to include in a future release?
Sorry if this has already been asked (the thread is pretty long now!), but how would I set the tag so that it gets any child category off the main category list. I see that it is easy to get it for specific parent categories. But what if I want it to be ANY child categories off of any of the main categories.
So for the example below it would automatically pull the child categories for the parent categories Pets, Furniture, and Plants. Then, if I added child categories for Artwork, it would add those as well. Does the plugin even allow for this?
Pets –dogs –cats –fish Furniture –couch –table –chair Artwork Plants –ferns –trees
Hi Laisvunas
I’m trying to get the imgsizer plugin to resize my child_category_image photo but it doesn’t seem to be working (page loads fine but nothing is output where the image should be).
My code is as follows:
{exp:child_categories parent="5" child_categories_sort_by="custom" child_categories_sort_direction="asc" show_empty="yes" entries_sort_by="date" entries_sort_direction="asc" site="2"}
{child_category_start}
<h2><a href="/{my_template_group}/c/{child_category_url_title}/">{child_category_name}</a></h2>
{exp:imgsizer:size src="{child_category_image}" width="100" alt="{child_category_name}"}
{child_category_description}
{child_category_end}
{/exp:child_categories}
I’ve done a search of the forums but can’t see anything related to this - do you know if it’s possible for the imgsizer plugin to be parsed within the exp:child_categories tag or will I simply have to resize my images manually?
Cheers and thanks for a fab plugin - I’m loving it.
Jim
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.