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
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
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
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.