0

I am new to EE and trying to figure out how to use it for our CMS needs. We have the following 2 channels, names self-explanatory: 1. News Articles 2. Press Releases These will have their own pages where all channel entries of each type are listed.

But also: On the homepage we display a "top story" which is always either a selected news article OR press release.

How do I give content managers the ability to tell EE what to display as top story on a given day, by selecting either a specific news article, or a specific press release?

2

You can do this a couple ways. One quick method is to either use the record status and add 'topStory' as a status, along with 'open', 'close' and other statuses. Then to use code like

{exp:channel:entries channel="news|press" limit="1" orderby="date" sort="desc" status="topStory"}

<div class="topStory">
    <h2>{title}</h2>
    <p>{news_summary}{press_summary}</p>
    <p class="readmore"><a href="" title="Read {title}">Read More</a></p>
</div>

{/exp:channel:entries}

You can stack fields like I did for {news_summary} versus {press_summary} when both will be evaluated but only one will be true. For example in this case. The {exp:channel:entries} tag is evaluating both channels news and press for the newest entry with the status of topStory. Generally speaking, only one entry will meet that criteria of newest so the second field will return empty.

This will also work, with multiple returns, so it could be

{exp:channel:entries channel="news|press" limit="5" orderby="date" sort="desc" status="topStory"}

but it will return the appropriate field data for that record.

Obviously, if your summary fields allow XHTML, don't use the <p> and </p> tags. I tend to make summary fields format as 'None'.

But this is a quick method. There are plenty of other methods, but adding the status group used by both both news and press releases, works. Though it will remove the 'top story' from other listings, unless you display both status 'open' and 'topStory'.

| improve this answer | |
  • Thanks nonprofit_tech that's very helpful. I am hoping to use the Publisher plugin, have you used it (or the Better Workflow plugin) and would you do the above differently in that case? – MDP Mar 6 '13 at 8:35
  • I've not used either, but they shouldn't interfere with the logic per say. You can set-up workflow approval, as you would, just make sure your 'topStory' is something the final editor or publisher had access rights to trigger. – nonprofit_tech Mar 6 '13 at 11:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.