We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Plugin: Child Categories

Development and Programming

Laisvunas's avatar
Laisvunas
879 posts
15 years ago
Laisvunas's avatar Laisvunas

Add

parse="inward"

parameter to exp:child_categories tag.

       
Eastwood Design's avatar
Eastwood Design
605 posts
15 years ago
Eastwood Design's avatar Eastwood Design
Add
parse="inward"
parameter to exp:child_categories tag.

perfect, just figured that out before you made your reply. Working like a charm!! thanks again.

       
NKT com's avatar
NKT com
124 posts
15 years ago
NKT com's avatar NKT com

Can we have a varible to access the Category URL Indicator. I want the client to be able to change this without having to edit templates. So this…

{parent_category_start}
<h1><a href="http://{homepage}/category/{parent_category_url_title}/">{parent_category_name}</a></h1>

could be this…

{parent_category_start}
<h1><a href="http://{homepage}/{category_url_indicator}/{parent_category_url_title}/">{parent_category_name}</a></h1>
       
NKT com's avatar
NKT com
124 posts
15 years ago
NKT com's avatar NKT com

Can I show entries only assigned to the parent category along side the child category titles?

       
vacquah's avatar
vacquah
355 posts
15 years ago
vacquah's avatar vacquah

I have a a rather puzzling problem … i have a parent category with just 2 child categories. however, when i use the code below, the 2 child categories are shown 5 times each. As you can see, I have pared down the code down to the bone-not sure why the child category names are repeating. Any ideas>

<h3>Categories</h3>
{exp:weblog:categories weblog="clients" limit="1" status="not draft"}
{exp:child_categories parent="95" show_empty="no" site="1" }
{child_category_start}
<a href="http://{homepage}/category/{child_category_url_title}/">{child_category_name}</a>
{entries_total}
{child_category_end}
{/exp:child_categories}
{/exp:weblog:categories}

Update: looks like it has something to do with wrapping the child category code with the exp:weblog tags. if i remove it. it works fine.

       
mucha's avatar
mucha
18 posts
15 years ago
mucha's avatar mucha

Thanks for this tremendously helpful plugin!!

       
Eric Blanpied's avatar
Eric Blanpied
22 posts
15 years ago
Eric Blanpied's avatar Eric Blanpied

I’m having trouble with a nested category_id & child_categories setup. I want the page to just display all the categories in categories_group 1 if no parent is specified, but otherwise use the supplied category as the parent. I’ve tried lots of things, and have found that having both the parent and category_group parameters specified results in the category_group being ignored, so I’ve tried to work around it with a conditional:

{exp:category_id category_group="1" category_url_title="{segment_3}" parse="inward" on_failure="none"}
    {exp:child_categories 
        {if category_id != "none"}
            parent="{category_id}"
        {if:else}
            category_group="1"
        {/if}
        parse="inward"}

  ... output stuff ...

    {/exp:child_categories} 
{/exp:category_id}

but that still doesn’t work. When no category is specified I get all categories from all groups.

Any advice?

thanks

-e

       
Paradise's avatar
Paradise
84 posts
15 years ago
Paradise's avatar Paradise

Does this Plugin work in EE 2?

       
NKT com's avatar
NKT com
124 posts
15 years ago
NKT com's avatar NKT com

Is it possible to just display parents and entries attached to them?

       
Laisvunas's avatar
Laisvunas
879 posts
15 years ago
Laisvunas's avatar Laisvunas

Hi,

Use the code

{parent_category_start}
{exp:weblog:entries category="{parent_category_id}"}

Some code

{/exp:weblog:entries}
{parent_category_end}
       
vmills's avatar
vmills
96 posts
15 years ago
vmills's avatar vmills

I have a trailing comma on a list of categories and I can’t figure out how to get rid of it. I didn’t see a backspace parameter in the documentation, and applying it to the enclosing weblog entries tag doesn’t work. Here’s just the code for the child categories tags I’m using:

{exp:child_categories parent="17|18|21"} 
{entries_start}
<a href="/books/category/{parent_category_url_title}/">{parent_category_name}</a>: <a href="/books/category/{child_category_url_title}/">{child_category_name}</a>, 
{entries_end}
{/exp:child_categories}

If I’ve missed something and there’s another way to search for support on this issue, please let me know. It would be awesome to have a “search this thread” button at the top of these long add-on support threads. After awhile, they just get too big to be useful. Should I submit a feature request to EllisLabs?

       
Laisvunas's avatar
Laisvunas
879 posts
15 years ago
Laisvunas's avatar Laisvunas

Hi,

To delete the last comma use plugin Find and Replace Plus.

       
vmills's avatar
vmills
96 posts
15 years ago
vmills's avatar vmills

Thank you. I’ve installed the Replace Plus plugin, but all my tests have failed. I’m not quite clear on where I should put the tags. Here’s what I’ve got (Dog is a category name; I’m just doing this to test):

{exp:replace_plus find="Dog" replace="find"}
{entries_start}
<a href="/books/category/{parent_category_url_title}/">{parent_category_name}</a>: <a href="/books/category/{child_category_url_title}/">{child_category_name}</a>, 
{entries_end}
{/exp:replace_plus}
{/exp:child_categories}

I suppose to remove the trailing comma I would use something like this?

{exp:replace_plus find="$," regex="yes"}
       
Laisvunas's avatar
Laisvunas
879 posts
15 years ago
Laisvunas's avatar Laisvunas

Hi,

You should wrap exp:child_categories tag with exp:replace_plus tag:

{exp:replace_plus find="Dog" replace="find" parse="inward"}

{exp:child_categories}

{entries_start}
<a href="/books/category/{parent_category_url_title}/">{parent_category_name}</a>: <a href="/books/category/{child_category_url_title}/">{child_category_name}</a>,
{entries_end}

{/exp:child_categories}

{/exp:replace_plus}
       
vmills's avatar
vmills
96 posts
15 years ago
vmills's avatar vmills

When I make the changes you suggest, the tags don’t parse and I get this:

Category: {entries_start} {parent_category_name}: {child_category_name}, {entries_end} {/exp:child_categories}

I’ve copied more of the template code I’m using below, with your suggestions. I didn’t see mention whether PHP needs to be turned off or on in the template for this plugin to work. Perhaps the location of the weblog entries tag affects it? I don’t really know what else to try.

<div class="entriesbot">
{exp:weblog:entries weblog="books"}
<div class="book">{exp:imgsizer:size src="{cover-img}" width="50" alt="{title}" class="book-img"}</div>
<h2>{title}</h2>
<div class="book-details">
<strong>Author</strong>: {author-first} {author-last}

<strong>Publication Date</strong>: {book-date format="%F %d, %Y"}

<strong>Length</strong>: {book-length} pages

<strong>Category</strong>: 

{exp:replace_plus find="Dog" replace="find" parse="inward"}

{exp:child_categories}

{entries_start}
<a href="/books/category/{parent_category_url_title}/">{parent_category_name}</a>: <a href="/books/category/{child_category_url_title}/">{child_category_name}</a>,
{entries_end}

{/exp:child_categories}

{/exp:replace_plus}

<strong>From the Publisher</strong>: {book-desc}

</div><!--end book-details div-->
{/exp:weblog:entries}
</div><!--end entriesbot div-->
       
First 20 21 22 23 24 Last

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.