Take the 2-minute tour ×
ExpressionEngine® Answers is a question and answer site for administrators, end users, developers and designers for ExpressionEngine® CMS. It's 100% free, no registration required.

I'm trying to get the category description and some custom fields of the currently "active" category. By "active" I mean based on a URL-segment. So if my category-structure looks like this:

  • websites
    • design
    • development
    • information-architecture
  • brochures

And my url is http://www.mydomain.com/portfolio/category/development i want to get the custom fields etc. from the category websites (because it's the top-level parent for development). What's the best way to do this?

Thanks,

  • Steven
share|improve this question

1 Answer 1

up vote 1 down vote accepted

I believe ExpressionEngine register the category on display as the active category, so from your example, the active category is 'development' NOT 'websites'. It sounds like you want to be able to pull data from the parent category.

I think the easiest way to accomplish this is to find a third-party add-on. You could probably do it with custom queries, but that may get complicated.

GWcode Categories offers very flexible ways to pull data from categories. You could definitely use that, though it maybe overkill for your needs. But once you get use to it, you may find you want to do more with categories more frequently. Plus its free.

Primary Categories by Solspace should also allow you to accomplish what you want. It's not free, but works more specifically on the issue you describe.

Category Parents Works directly on the issue at hand. Grabs data from the parent category.

Low Seg2Cat may also work. It's free, and allows for you to work with url segments to grab categorical information.

There are a lot of add-ons that deal with categories, over 70 at Devot-ee, you can go for one that works specifically on your issue (parent-child relations) or find a nice all purpose tool like GWCode Categories or others.

Either solution will work. If your site is pretty simple, I recommend just going with something like Category Parent, if you think you'll need more flexibility with categories across the board, then look at GWCode.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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