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

List entries from channel based on category with a category heading

How Do I?

Russ K.'s avatar
Russ K.
114 posts
9 years ago
Russ K.'s avatar Russ K.

How would I print each of the entries from a channel by category to the screen and use the category name as the heading for each all in one query? Is this possible?

Example: If I have 2 categories - “Colors” & “Numbers” and in my channel, I have entries “Red”, Green”, “Blue” assigned to my Colors Category and then entries “One”, “two”, “Three” assigned to the Numbers category

I want to print to screen:

Colors Red Green Blue

Numbers One Two Three

In reality, what I have is a list of weblinks that all are categorized… if the client adds a new category I want that category and anything assigned to it printed to the screen without having to edit the Code.

I hope this makes sense.

Thanks. Russ

       
Ingmar Greil's avatar
Ingmar Greil
29,243 posts
9 years ago
Ingmar Greil's avatar Ingmar Greil

I think you want the Channel Category Archive Tag.

       
Russ K.'s avatar
Russ K.
114 posts
9 years ago
Russ K.'s avatar Russ K.

Thank you Ingmar.. I appreciate it… Didn’t realize that was the use for that (although now that I look through it I obviously should have looked closer…)

A follow up question… If I have a seperate field for a destination URL (these point to external links) can I access that and if it is empty, not include the link tags and if it is populated, add the link tags as well as an icon?

I know the “How” of doing that, but can’t tell if I can access the “destination_url” field or not.

Thanks. Russ

       
Ingmar Greil's avatar
Ingmar Greil
29,243 posts
9 years ago
Ingmar Greil's avatar Ingmar Greil

Is that a custom category field? I don’t see why they shouldn’t be accessible, yes. Give it a try.

       
Russ K.'s avatar
Russ K.
114 posts
9 years ago
Russ K.'s avatar Russ K.

I gave it a try… and used this code (picking up from the example given in the docs)

{entry_titles}
   {if destination_url != ""}
      <li class="list-group-item"><a href="http://{destination_url}" target="_blank" rel="noopener"><i class="fa fa-link"></i> {title}</a></li>
   {if:else}
      <li class="list-group-item">{title}</li>
   {/if}
{/entry_titles}

But it doesn’t seem to recognize the Custom Category…

Any thoughts? or maybe I’m not using it right?

Russ

       

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.