Hi,
I have two channels: programs and events.
Each channel entry has a status and I want to show a program or event with a status of “featured”, but if there are none, I want to show any random program with a status of “open”.
This is how I tried to do it:
{exp:channel:entries channel="programs|events" status="featured" limit="1" orderby="random"}
{if channel == "Programs"}
<a href="http://{url_title_path=programs}"> _ {if featured_image}_ {featured_image}_ {/if}_ <span class="featured_title"><span>{title}</span></span>_ <span class="featured_summary">{one_liner}…»</span> _ </a>
{/if}
{if channel == "Events"}
<a href="http://{url_title_path=events}"> _ {if event_featured_image}_ {event_featured_image}_ {/if}_ </a>
{/if}
{if no_results}
{exp:channel:entries channel="programs" status="open" limit="1" orderby="random"}
<a href="http://{url_title_path=programs}"> _ {if featured_image}_ {featured_image} _ {/if}_ <span class="featured_title"><span>{title}</span></span>_ <span class="featured_summary">{one_liner}…»</span> _ </a>
{/exp:channel:entries}
{/if}
{/exp:channel:entries}The {if no_results} section doesn’t seem to work properly. I’m guessing it’s something about having a nested channel entries tag?
What’s the best way to do this?