Search code examples
expressionengine

ExpressionEngine: Display related entries from another channel in a single entry of one channe


I have two channels, events and news. Both have the same category group assigned (international, national, rock, etc.). I need to display a Widget of news entries that belong to the same category as the event in the single entry of the event. Something like

{exp:channel:entries channel="event" require_entry="yes"}

{!-- here the event information is displayed --}

<div class="widget"><h2>News</h2>
{exp:channel:entries channel="news" dynamic="no" category="????"}
{/exp:channel:entries}
</div>

{/exp:channel:entries}

Is this possible from within EEs or do I need a plugin/development?


Solution

  • Good news, EE will do this for you :)

    Add related_categories_mode="yes" to the exp:channel:entries tag for the news channel then go get yourself a beer with all the time you've saved.

    https://docs.expressionengine.com/latest/channel/channel_entries.html#related-categories-mode