group for non-repeatable fields
-
Hi there,
I show in this article that you mentioned that group for non-repeatable fields are possible now, but I can’t see any documentation on how we can add that.
I tried to add as below but when it is being saved it creates 3 copy of the same fields.
$tools_metabox->add_field( [ 'id' => 'test', 'type' => 'group', 'repeatable' => false, // Repeatable fields are supported w/in repeatable groups (for most types) 'fields' => [ [ 'name' => 'test 1', 'id' => 'point_0', 'type' => 'wysiwyg', 'before' => sprintf( '<span class="description">%1$s</span><span data-max-chars="80" data-count-id="_test_point_0">%2$s</span>', __( 'Max. 15-30 words.', '' ), MaxCharacters\get_character_count_markup( 80, '' ) ), 'options' => [ 'wpautop' => true, 'textarea_name' => 'point_0', 'textarea_rows' => 3, 'teeny' => false, 'default_editor' => 'tinymce', 'media_buttons' => false, 'quicktags' => true, 'tinymce' => [ 'resize' => false, 'wordpress_adv_hidden' => false, 'add_unload_trigger' => false, 'statusbar' => false, 'wp_autoresize_on' => false, 'verify_html' => false, // Prevent deleting default empty tags. 'toolbar1' => 'bold,italic,link,unlink', 'toolbar2' => '', ], ], 'classes'=> [ 'test-row', ], ], [ 'name' => 'Test 2', 'id' => 'point_1', 'type' => 'wysiwyg', 'before' => sprintf( '<span class="description">%1$s</span><span data-max-chars="80" data-count-id="_test_point_1">%2$s</span>', __( 'Max. 15-30 words.', '' ), MaxCharacters\get_character_count_markup( 80, '' ) ), 'options' => [ 'wpautop' => true, 'textarea_name' => 'point_1', 'textarea_rows' => 3, 'teeny' => false, 'default_editor' => 'tinymce', 'media_buttons' => false, 'quicktags' => true, 'tinymce' => [ 'resize' => false, 'wordpress_adv_hidden' => false, 'add_unload_trigger' => false, 'statusbar' => false, 'wp_autoresize_on' => false, 'verify_html' => false, // Prevent deleting default empty tags. 'toolbar1' => 'bold,italic,link,unlink', 'toolbar2' => '', ], ], 'classes'=> [ 'test-row', ], ], [ 'name' => 'Test 3', 'id' => 'point_2', 'type' => 'wysiwyg', 'before' => sprintf( '<span class="description">%1$s</span><span data-max-chars="80" data-count-id="_test_point_2">%2$s</span>', __( 'Max. 15-30 words.', '' ), MaxCharacters\get_character_count_markup( 80, '' ) ), 'options' => [ 'wpautop' => true, 'textarea_name' => 'point_2', 'textarea_rows' => 3, 'teeny' => false, 'default_editor' => 'tinymce', 'media_buttons' => false, 'quicktags' => true, 'tinymce' => [ 'resize' => false, 'wordpress_adv_hidden' => false, 'add_unload_trigger' => false, 'statusbar' => false, 'wp_autoresize_on' => false, 'verify_html' => false, // Prevent deleting default empty tags. 'toolbar1' => 'bold,italic,link,unlink', 'toolbar2' => '', ], ], 'classes'=> [ 'test-row', ], ], ] ] );Can you please advise what am I doing wrong?
Viewing 6 replies - 1 through 6 (of 6 total)
Viewing 6 replies - 1 through 6 (of 6 total)
The topic ‘group for non-repeatable fields’ is closed to new replies.