Skip to content

Instantly share code, notes, and snippets.

@mattradford
Created December 18, 2014 14:02
Show Gist options
  • Save mattradford/2b52500b12cd313ebaa6 to your computer and use it in GitHub Desktop.
Save mattradford/2b52500b12cd313ebaa6 to your computer and use it in GitHub Desktop.
Opening times custom fields
if(get_field('override_opening_time', 'options')) :
echo '<span>' . get_field('override_message', 'options') . '</span>';
else :
$time = current_time('timestamp');
$day = date('N', $time);
if($day==1) :
$today = get_field('monday', 'options');
elseif($day==2) :
$today = get_field('tuesday', 'options');
elseif($day==3) :
$today = get_field('wednesday', 'options');
elseif($day==4) :
$today = get_field('thursday', 'options');
elseif($day==5) :
$today = get_field('friday', 'options');
elseif($day==6) :
$today = get_field('saturday', 'options');
elseif($day==7) :
$today = get_field('sunday', 'options');
endif;
if($day == 6 || $day == 7) :
_e('Today we are','roots');
echo ' <span>' . $today . '</span>';
else :
_e('Open today','roots');
echo ' <span>' . $today . '</span>';
endif;
endif;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment