/** * outputs the meta box */ function meta_box_callback() { // Use nonce for verification wp_nonce_field('custom_meta_box_nonce_action', 'custom_meta_box_nonce_field'); // Begin the field table and loop echo '<table class="form-table meta_box">'; foreach ($this->fields as $field) { if ($field['type'] == 'section') { echo '<tr> <td colspan="2"> <h2>' . $field['label'] . '</h2> </td> </tr>'; } else { echo '<tr> <th style="width:20%"><label for="' . $field['id'] . '">' . $field['label'] . '</label></th> <td>'; $meta = get_post_meta(get_the_ID(), $field['id'], true); echo custom_meta_box_field($field, $meta); echo '<td> </tr>'; } } // end foreach echo '</table>'; // end table }
/** * outputs the meta box */ function meta_box_callback() { // Use nonce for verification wp_nonce_field('custom_meta_box_nonce_action', 'custom_meta_box_nonce_field'); // Begin the field table and loop echo '<table class="form-table meta_box">'; foreach ($this->fields as $field) { if ($field['type'] == 'section') { echo '<tr> <td colspan="2"> <h2>' . $field['label'] . '</h2> </td> </tr>'; } elseif ($field['type'] == 'icons') { echo '<tr> <th><label for="' . $field['id'] . '">' . $field['label'] . '</label></th> <td>'; $meta = get_post_meta(get_the_ID(), $field['id'], TRUE); echo custom_meta_box_field($field, $meta); echo '<td></tr>'; } elseif ($field['type'] == 'gallery') { echo '<tr> <td>'; $meta = get_post_meta(get_the_ID(), $field['id'], TRUE); echo custom_meta_box_field($field, $meta); echo '<td></tr>'; } else { $row_divider_class = isset($field['divider']) ? ' class="meta-box-divider"' : ''; echo '<tr' . $row_divider_class . '> <th><label for="' . $field['id'] . '">' . $field['label'] . '</label></th> <td>'; $meta = get_post_meta(get_the_ID(), $field['id'], TRUE); echo custom_meta_box_field($field, $meta); echo '<td> </tr>'; } } // end foreach echo '</table>'; // end table }