I'm sure I'm going to do a horrible job explaining this, so apologies in advance.

I have two different blogs (Blog and Featured), two different category groups (Blog and Decades), and I'm having a problem linking items in my category groups to the correct page. Here's an example of my Decades snippet:

    {exp:channel:categories channel="blog|featured" style="linear" category_group="not 10"     show_empty="no"}
    <li><a href="">{category_name}</a></li>

If I'm allowed to use multiple channels in the channel= parameter, what do I link the {category_name} to? Either blog can select the Decades Category group, so if I want someone to see all the posts in the 1910 category, regardless if the post was made in the blog channel or the decades channel, how would I go about it?


If you are simply displaying the archive with a single template and dynamically displaying category headings, etc.? As long as the category name is unique (even across category groups, this is necessary unless you plan to use the category ID in the URL) you can use the category url title. You wind up having to do something similar with your entries loop - piping both channel names info the channel parameter. You may need some conditionals within your loop to handle any differences between what custom fields are within each field group (assuming for the moment that they don't share a field group) - for that I'd recommend using switchee or ifelse.

  • Thanks for the answer - I'm using switchee, my category names are unique across both groups... not sure how I need to use the category_url_title though. Can you expand on that?
    – Shad
    Apr 5 '13 at 13:56
  • It should just be <li><a href="{path=template_name}">{category_name}</a></li> - using path between the channel:categories tag pair automatically turns the URL into a category url title path. Apr 5 '13 at 14:01
  • Thanks for your patience Jean - your answer makes sense, but therein lies my problem; I don't know what put in for the template name. I have two different template groups that control the featured channel and the blog channel.
    – Shad
    Apr 5 '13 at 14:46
  • Ah. I see. So you likely need a different template to go to each, depending on which channel the category comes from. Each category group would have distinct parent ids, perhaps (which category group was a variable in the loop but it doesn't appear to be) so you could try something like {if parent_id == "1"}<a href="{path=template_group_for_decades}">{category_name}</a>{/if} where "1" is the parent ID for decades, for example. Apr 5 '13 at 18:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.