ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Filter entries by Parent Category

July 29, 2009 7:57pm

Subscribe [2]
  • #1 / Jul 29, 2009 7:57pm

    cmcnabb

    13 posts

    Hi, I am trying to filter entries based on an entries parent category id.

    Here is my code:

    {exp:weblog:entries weblog="business_listings" status="Featured" orderby="random" category="not 15"}


    Here are my categories:
    Restaurants - id: 15
    ->Italian - id: 22 (child of restaurants)
    ->American - id: 23 (child of restaurants)
    etc..

    so I don’t see any entries with category - id:15 but I do see entries with category id: 22
    How can I do this without hard-coding the child ids into the category list?
    I know the parent category (id = 15) will never change but child categories will be added on the fly and I don’t want to have to go in and change the code every time a new child category is added.

    So something like this is what I am looking for:
    parent_category=“not 15”

    Thanks

  • #2 / Sep 16, 2009 8:44pm

    EliVZ

    37 posts

    I had the same problem as you, and ended up writing a quick plugin to do just this. You can find it at: http://ellislab.com/forums/viewthread/129357/

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases