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.

How to limit weblog:entries to only show entries that belong to a parent category

August 19, 2009 10:37am

Subscribe [3]
  • #1 / Aug 19, 2009 10:37am

    sthmtc

    11 posts

    I’m looking for something like:

    {exp:weblog:entries parent_only="yes"}
           {title}
    {/exp:weblog:entries}

    So that entries that are assigned to a child category are not being rendered. Only those who are assigned to a parent category.

    There’s a similar thread over here, but they didn’t came up with any solution either.

    Maybe a custom query? Or some PHP wizardry?

  • #2 / Aug 19, 2009 10:55am

    Ingmar

    29245 posts

    Yes, a custom query would be the way to go. Basically, display all entries whose parent category id = 0, meaning that they belong to a parent category.

  • #3 / Nov 18, 2009 11:25am

    astuteo

    36 posts

    Has anyone solved this issue yet?

    I’m working on a fairly elaborate site that goes three levels deep. I have the 3rd level of entries tagged with both their parent category (i.e. Section 2) and their individual category (i.e. Chapter 4).

    On the overview page for each section, I would like to show only the entry that’s tagged with the parent category (Section 2) and not all the entries in the subcategories.

    Solutions exist if I were using the Categories tag, but since it’s the entries one I can’t figure it out.

    {exp:weblog:entries  weblog="{my_weblog}" category="{segment_1_category_id}" }    
      <h2>{title}</h2><p>        <br />
      {body}<br />
    {/exp:weblog:entries}

    I’m also using the Seg2Cat extension, thus the category id variable in the code above. It’s irrelevant, but just so you know.

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

ExpressionEngine News!

#eecms, #events, #releases