Problems with group and text_date
-
Hi!
I’m having problems with fields text_date and group
I have this code in cmb2_mb.php:
<?php $mb_group = $mb -> add_field(array( 'id' => 'mb_group', 'type' => 'group', 'repeatable' => false, 'options' => array( 'group_title' => 'Group:', 'sortable' => false, ), )); $mb -> add_group_field($mb_group, array( 'id' => 'mb_group_text_date', 'type' => 'text_date', 'name' => 'Text date:', )); $mb -> add_group_field($mb_group, array( 'id' => 'mb_group_text', 'type' => 'text', 'name' => 'Text:', )); ?>
Then this code in my single.php:
<?php $mb_group = get_post_meta(get_the_ID(), 'mb_group', true); foreach ((array) $mb_group as $key => $entry) { if (isset($entry['text_date'])) { $text_date = esc_html($entry['text_date']); } if (isset($entry['mb_group_text'])) { $mb_group_text = esc_html($entry['mb_group_text']); } } ?>
But the field text_date is not printed.
Other fields (text, radio_inline, select and text_time), if they are printedCan you help with this?
Thanks
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Problems with group and text_date’ is closed to new replies.