Skip to content

Instantly share code, notes, and snippets.

@LinzardMac
Created January 23, 2015 22:17
Show Gist options
  • Save LinzardMac/95b29bf0a096d17bab92 to your computer and use it in GitHub Desktop.
Save LinzardMac/95b29bf0a096d17bab92 to your computer and use it in GitHub Desktop.
$myposts = get_posts( $args );
$fri = date('Y-m-d',strtotime('friday this week'));
$sat = date('Y-m-d',strtotime('saturday this week'));
$sun = date('Y-m-d',strtotime('sunday next week'));
// one of the posts dumped in this has the "single date" array
var_dump($myposts);
foreach ( $myposts as $post ) : setup_postdata( $post );
$customdates = get_post_meta($post->ID,'custom_date', true);
//$customdates is what is tossing the error
foreach ($customdates as $eventday)
{
switch ($eventday) {
case $fri:
$friray[]=$post->ID;
break;
case $sat:
$satray[]=$post->ID;
break;
case $sun:
$sunray[]=$post->ID;
break;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment