I’m trying to create a Calender display on a WordPress website. On each day a list of activities that is available ill be show.
At the moment I have it set up so each activity is a new custom post type (‘activity’) and on the edit page, using Advanced Custom fields and there check box option (field name ‘day’) you can select monday Tuesday etc.
I can display the days its available on the activity post (i.e ‘Football’ or ‘Swimming’) through the following code:
<?php
/*
* Conditional statement (Checkbox value is an array)
*/
if( in_array( 'tuesday', get_field('day') ) )
{ ?>
<?php the_title();?>
<?php } ?>
But I want all posts to be displayed on a Summary/Archive page within the correct day – currently set up like so:
<div class="day-container">
<span class="day">Tu<span class="not-mobile">esday</span></span>
<ul>
<li class="swimming"> <div class="icon"> </div> Swimming</li>
<li class="fitness"> <div class="icon"> </div> Fitness</li>
<li class="walks"> <div class="icon"> </div> Health Walks</li>
</ul>
</div>
<div class="day-container">
<span class="day">Tu<span class="not-mobile">esday</span></span>
<ul>
<li class="swimming"> <div class="icon"> </div> Swimming</li>
<li class="fitness"> <div class="icon"> </div> Fitness</li>
<li class="walks"> <div class="icon"> </div> Health Walks</li>
</ul>
</div>
... etc
So after a while of plugging away I managed it, See answer below if anyone gets into the same problem!