I am trying to use 3 custom fields from wordpress posts to build an array. I need to show and hide a div based on what time it is. I have a start, an end and a name which is also set as a css class in the template. That part works if I set the array manually. But I want to build it on the fly. Not having too much luck. Can someone help?
$hrs = array(
array("2013-07-27 13:00", "2013-07-27 13:49", "cucu"),
);
//get current category id
$current_cat = get_query_var('cat');
//get posts that belong to current category
$args = array( 'category' => $current_cat, 'post_type' => 'post' );
$postslist = get_posts( $args );
$hrs = array();
foreach ($postslist as $post) :
$key_1 = get_post_meta( $post->ID, 'Start',true );
$key_2 = get_post_meta( $post->ID, 'End',true );
$key_3 = get_post_meta( $post->ID, 'Name',true );
$hrs[]=$key_1;
$hrs[]=$key_2;
$hrs[]=$key_3;
endforeach;
var_dump($hrs);