I have a page where I am allowing the client to choose which channel entries are displayed on the page, which is controlled by a field with checkboxes on the publish page.
If rides is checked, I need to display entries from the ride channel. If rides and gear is checked, I need to display entries from both.
I have never had to use checkboxes as a field before, and am unsure how to display content only if a specific checkbox is checked. The values of my checkboxes are:
Rides
Gear
Group
The name of my custom checkbox field is choose_entries
{exp:channel:entries channel="pages" limit="1" url_title="{segment_1}"}
{if choose_entries == "Rides"}
<h2 class="section-title">Rides<span class="green"></span></h2>
{embed="views/.rides"}
<img src="content/img/bike.png" />
{/if}
{if choose_entries == "Gear"}
<h2 class="section-title">Gear<span class="orange"></span></h2>
{embed="views/.gear"}
{/if}
{if choose_entries == "Groups"}
<h2 class="section-title">Groups<span class="blue"></span></h2>
{embed="views/.groups"}
{/if}
{/exp:channel:entries}
I'm pretty sure my conditionals are incorrect at present, I need some help getting them to work properly. Thank you!
And in case it's needed, here is an example of one of the embedded templates, but they display properly on their own.
{exp:channel:entries channel="rides" orderby="date" dynamic="no" sort="asc" limit="5" show_future_entries="yes"}
<article class="rides left">
<img src="{ride_img:excerpt}" alt="{title}, ${event:price}" />
<div class="content">
<h2>{title}</h2>
<p class="lead">${event:price}</p>
<p>{ride_excerpt}</p>
{if "{event:can_purchase}" == "y"}
<p class="read-more"><a class="blue" href="{path=checkout/quantity/{event:id}}">Book now</a></p>
{if:else}
<p><strong>Tickets are not available</strong></p>
{/if}
</div>
</article>
{/exp:channel:entries}
Note: I am using Pages and Better Pages to make use of a template across multiple pages, if that complicates matters any.