I’m new to developing sites on EE, and am developing two sites to run off the Multiple Sites Manager in EE5. Both will have their own news listing pages but I’d like to be able to share specific news stories from Site A to also be displayed on Site B’s new page, mixed in with the ‘native’ news stories that were uploaded directly to Site B.
On each site I’ve created a ‘News’ channel and on Site A I associated with the News channel a category called ‘Add to Site B’ that the content author could tick when uploading a news article. What I’m struggling with is how to display in one list all the entries from Site B’s News channel plus only the entries from Site A’s News channel that have been marked with the ‘Add to Site B’ category.
In the template for the news listing page on Site B I’ve got this code, which currently displays all the news entries from both sites:
<h1>News</h1>
{exp:channel:entries channel="news" site="site-a|site-b"}
<h2>{title}</h2>
{news_abstract}
{/exp:channel:entries}
I feel like EE’s conditional tags could help with this but I haven’t been able to incorporate {if}{/if}, etc, in the correct way yet, so grateful for any help!
Hrm- the problem is you can’t do one set of parameters for site a and another set for site b- not using a single tag, anyway.
Without doing something really complex, I’d go one of two options. 1. Just have a second section/entry tag for the entries shared from the other site. They’re already presumably a bit unique, so incorporate that into the site. 2. You’re going to need an indicator on both site a AND site b of which entries to include.
To make it easiest, you might use a status ‘Site B News’ and have the site b news channel default to that status so they don’t have to do anything extra. Site a could default to ‘open’. And then site a shows only site a, status open and ‘b’ while site b shows both a and b but only status ‘Site B’.
It’s a bit of tweaking, but it would work and be a reasonable workflow.
Thanks for the quick reply and the useful suggestions. Building on the suggestion to use status, instead I’ve created categories ‘Display on Site A’ and ‘Display on Site B’ for the news channels in each site. On Site A, the ‘Display on Site A’ category is ticked by default on new channel entries and on Site B, the ‘Display on Site B’ category is ticked by default, then the user can opt to share it on the other site by ticking the other category too.
Then I’ve set the news listing page on each site to display news channel entries from both sites that have either of those two categories (using their IDs):
<h1>News</h1>
{exp:channel:entries channel="news" site="site-a|site-b" category="3|2"}
<h2>{title}</h2>
{news_abstract}
{/exp:channel:entries}
As an entry can have more than one category (but only one status), that has the added benefit of letting me share articles in both directions (from either site to the other).
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.