Wednesday, May 16, 2012

wpalchemy and datetime input

I'm trying to get to work a datetime input in a metabox with wpalchemy. The way I'm doing, I can get the date and time, but I need to pass this content, to a datetime object, using strtotime. And for this, I'm using the save_filter option. The function:



function save_datetime($meta, $post_id) {
// var_dump($meta);
//var_dump($post_id);
//exit;

$dd = $meta['start_day'];
$mm = $meta['start_month'];
$yy = $meta['start_year'];
$hh = $meta['start_hour'];
$mn = $meta['start_minute'];
$start_datetime = strtotime( $dd . $mm . $yy . $hh . $mn );

//$meta['start_datetime'] = $start_datetime;
update_post_meta($post_id, '_info_evento_start_datetime', $start_datetime);

return $meta;
}


But the information is not recorded at the database. The two files can be found here and here.



How can I write in database with this function?





No comments:

Post a Comment