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

How do I create a News page with articles from different channels?

How Do I?

yzs's avatar
yzs
40 posts
7 years ago
yzs's avatar yzs

I wanted to create a frontpage news with about 10 articles per page, the article has 2 fields mainly the poster image and the short description, these articles can come from any channels thats why its News as in whenever a latest entry will be created from any channel will show up on top of the news page. I do not want 10 entries per channel showing on the news page but 10 entries from any channel that was posted the latest. How to do this?

       
webmvp's avatar
webmvp
6 posts
7 years ago
webmvp's avatar webmvp

It is described here:

https://docs.expressionengine.com/latest/channel/channel_entries.html#channel

From which channel to show the entries (will show all channels if no channel is specified). Additionally, you can use the pipe character to separate multiple channels:

channel=”channel1|channel2|channel3”

if you add to this orderby, sort and limit, you will get total of 10 entries, ordered by date, from channels you specify

limit=”10” orderby=”date” sort=”desc”

       
yzs's avatar
yzs
40 posts
7 years ago
yzs's avatar yzs

Yes i get it i have to do this {exp:channel:entries channel="news" limit="10"}

{title}

{body} {/exp:channel:entries}

But my problem is the Body field

What if the body field is different from the other channel lets say Channel 1 has Title Short text description

While Channel 2 has Title Audio file


So that would be confusing.

       
Jeremy S.'s avatar
Jeremy S.
353 posts
7 years ago
Jeremy S.'s avatar Jeremy S.

Use a conditional maybe? If field 1 exists display it, else display field 2.

https://docs.expressionengine.com/latest/templates/conditionals.html

       

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.