super-cpt
super-cpt copied to clipboard
Add Repeatable Meta Fields
Would love the ability to have a repeatable meta box
+1
+2
+3
+4
So here's a thought I have about how this could be implemented:
Introducing a new type repeater
, which can be declared like so:
$meta->add_meta_box( array(
'id' => 'staff_details',
'fields' => array(
'name' => array( 'type' => 'text' ),
'repeat' => array(
'type' => 'repeater' ,
'subfields' => array(
'profile_image' => array(
'type' => 'media'
)
)
)
)
)
The repeater field will have a subfields
argument that can take in an array of fields just like the current implementation.
The problem with this is the many level of nested array could be confusing and prone to errors. It is also worth thinking about whether we should only allow 1 level of subfields
.
thanks, it is really helpful
I'll be needing something like this shortly. I can try and put something together over the next two weeks. I like @tnguyen14 's thoughts. Are there more opinions on how to implement this?
Maybe like this for individual repeating field(s)
$tests->add_meta_box( array(
'id' => 'test-box',
'context' => 'normal',
'fields' => array(
'test-field-one' => array('type'=>'text', 'repeat' => true)
)
) );
And like this for repeatable box(es)
$tests->add_meta_box( array(
'id' => 'test-box',
'context' => 'normal',
'fields' => array(
'test-field-one' => array('type'=>'text')
),
'repeat' => true
) );
+5
Is this feature still on the horizon?
I do have to ask if this feature will be added anytime soon, that would be the bomb. Please let us know, thank you.
I have a working prototype that I've used in several production sites. It only handles single level repeating groups and the ui needs to be refined. I'm going to get in touch with @mboynes.
@sixlive Care to share?
Is this project still active? Last update to it was back in July.
+1 It seems that when a project starts supporting loop/repeater/nested fields it is abandoned. 😿