What I was trying to do was dynamically get a “child category ID” on a single entry page. Ideas?
Child categories plugin has variable {child_category_id}. I do not understand what’s so problematic about single-entry page.
Can you post some code which does not output something which you think it should output?
I was hoping to use the category_id and the child_category_id to be able to pull in the entries from a specific subcategory. Since a single entry page doesn’t have anything in the URL to pull category info I haven’t been able to pull entries ONLY from the subcategory of the current single entry.
Hi horizonvp,
It is allways possible to pass category info through URL. For example, you can do it by forming URL using category_url_title:
{path=my_template_group/my_template/category/category_url_title}{url_title}/
If you do this, then segment_4 will be category_url_title. Then you will be able to get category id number using Category Id plugin.
Hi heaversm,
The code you provided works on my ExpessionEngine installation correctly.
If it does not work for you, then you may try:
1) doublecheck if “12” is really a number of a category which has some subcategories and those subcategories have some entries (plugin has “show_empty” parameter set to “no” by default)
2) uninstall and install the plugin;
3) try to type your code on a blank template.
If after trying this it still does not work for you, then I’m afaid I cannot help anymore.
Hi,
I have a strange problem:
My category structure:
Project (id = 17) — project beschrijving — Locatie en omgeving — Foto’s — Contact informatie
Wijn (id = 18) — Wijn algemeen — Soorten en kenmerken — Onze wijnkelder — Wijn foto’s
Ons Weblog (id = 33) — Het avontuur
I use this code to display the main category and the subcategories in a menu:
{assign_variable:site_weblog="site"}
{assign_variable:site_group="live"}
{assign_variable:c_template="cat"}
<div id="header">
<div id="navigation_top">
<ul>
<li><a href="#">home</a></li>
<li><a href="#">contact</a></li>
</ul>
</div>
<div id="navigation_main">
{exp:weblog:categories show="17|18|33" weblog="{site_weblog}"}
<div class="tab{if category_id == 17} first{if:elseif category_id == 33} last{/if}">
<h1>{category_name}</h1>
{exp:child_categories parent="{category_id}" child_categories_sort_by="custom"}
{child_category_start}
<a href="http://{homepage}/{site_group}/{child_category_url_title}/">{child_category_name}</a>
{child_category_end}
{/exp:child_categories}
</div>
{/exp:weblog:categories}
</div>
</div>
Somehow, the following child categories are not diplayed:
Foto’s (parent = Project) Wijn Foto’s (parent = Wijn) Het avontuur (parent = Ons Weblog)
I cannot figure out what the problem is, maybe someone can help me?
The website = http://italie.omvantedromen.nl
Getting errors for empty vars in the category tree:
Notice: Undefined variable: parent_cat_description in /home/public_html/core/plugins/pi.child_categories.php on line 426
Notice: Undefined variable: parent_cat_image in /home/public_html/core/plugins/pi.child_categories.php on line 427
strange as this is a page where they will not show, but can i suppress the errors or will i need to enter values in the category pages?
Parent category = child category
Parent category 1 and Parent category 2 are on the same level.
For better explanation, I’m using code:
{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="1"}
{parent_category_start}
<h1><a href="http://{homepage}entry/{parent_category_url_title}/">{parent_category_name}</a></h1>
{parent_category_end}
{child_category_start}
<h2><a href="http://{homepage}entry/{child_category_url_title}/">{child_category_name}</a></h2>
Performances: {entries_total}
{child_category_end}
{/exp:child_categories}
It generated something like this:
Live performances
1980 The Bridgehouse Era
Performances: 46
1981 New Life Tour
Performances: 12
But, I would like to display date range (date of the first and last entry in the child category).
Live performances
1980 The Bridgehouse Era (from 8.1.1980 to 24.4.1980)
Performances: 46
1981 New Life Tour (from 6.6.1981 to 20.9.1981)
Performances: 12
I think it’s not possible, but better to ask author 😉
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.