/** * Repeatable Custom Fields in a Metabox * Author: Helen Hou-Sandi * * From a bespoke system, so currently not modular - will fix soon * Note that this particular metadata is saved as one multidimensional array (serialized) */ function hhs_get_sample_options() { $options = array ( 'Option 1' => 'option1', 'Option 2' => 'option2', 'Option 3' => 'option3', 'Option 4' => 'option4', ); return $options; } add_action('admin_init', 'hhs_add_meta_boxes', 1); function hhs_add_meta_boxes() { add_meta_box( 'repeatable-fields', 'Repeatable Fields', 'hhs_repeatable_meta_box_display', 'post', 'normal', 'default'); } function hhs_repeatable_meta_box_display() { global $post; $repeatable_fields = get_post_meta($post->ID, 'repeatable_fields', true); $options = hhs_get_sample_options(); wp_nonce_field( 'hhs_repeatable_meta_box_nonce', 'hhs_repeatable_meta_box_nonce' ); ?>
| Name | Select | URL | |
|---|---|---|---|
| Remove | |||
| Remove | |||
| Remove |