Код: Выделить всё
function frontend_add_age_group_field ( $fields ) {
$fields['event']['event_age_group'] = array(
'label' => __( 'Age Group', 'event_manager' ),
'type' => 'multiselect',
'options' => array(
'kids' => __( 'Kids (7-10 Years)', 'wp-event-manager' ),
'youngsters' => __( 'Youngsters (10-14 Years)', 'wp-event-manager' ),
'youth' => __( 'Youth (15-25)', 'wp-event-manager' ),
'adults' => __( 'Adults (25+)', 'wp-event-manager' ),
),
'required' => true,
'priority' => 4,
);
return $fields;
}
Код: Выделить всё
a:3:{i:0;s:10:"youngsters";i:1;s:5:"youth";i:2;s:6:"adults";}
Код: Выделить всё
function get_event_age_group()
{
global $post;
$data = get_post_meta( $post->ID, '_event_age_group' );
$age_groups = $data['options'];
return $age_groups;
}
Подробнее здесь: https://stackoverflow.com/questions/433 ... -in-arrays
Мобильная версия