- This topic has 1 reply, 2 voices, and was last updated 8 months, 3 weeks ago by .
-
Topic
-
Hello, I need a select 2 custom field, is possible use select2 library in my own filds?
I have de next field, Please consider that field is in group and the group is clonable
add_action( 'init', function() { if ( class_exists( 'RWMB_Field' ) ) { class RWMB_Versiones_Field extends RWMB_Field { public static function html( $meta, $field ) { $html = ''; $html .= '<select name="' . $field['field_name'] . '" id ="' . $field['id'] . '" class="rwmb">'; foreach($GLOBALS['versiones'] as $key => $value){ $selected = ($value['vers_id']==$meta)?' selected':''; $html .= '<option value="' . $value['vers_id'] . '"' . $selected . '>' . $value['vers_nombre'] . '</option>'; } $html .= '</select>'; return $html; } } } } );
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- You must be logged in to reply to this topic.