$box['priority'] = 'high'; } add_meta_box($box['box_name'], $box['box_title'], 'st_show_meta_box', $box['post_type'], $box['context'], $box['priority'], $box['settings']); } } // add meta post to post type add_action('admin_init', 'st_add_post_metabox', 10, 2); function st_show_meta_box($post, $args = array()) { global $st_meta_boxs, $post, $pagenow; // $st_meta_box_opts = $st_meta_boxs['post_type'][$post->post_type]; $st_meta_box_opts = $args['args']; // echo var_dump($st_meta_box_opts); if (empty($st_meta_box_opts)) { return false; } echo '<input type="hidden" name="st_meta_box_nonce" value="', wp_create_nonce(basename(__FILE__)), '" />'; echo '<div class="STpanel-tab-p st_meta_boxs" >'; // display metabox options if (count($st_meta_box_opts) > 1) { echo '<div class="st_pt_tabs">'; $i = 1; foreach ($st_meta_box_opts as $tab_id => $t) { $class = $i == 1 ? ' active' : ''; $i++; // don't remove space before name of class echo '<a class="st_pt_tab' . $class . '" href="#" for-tab="' . esc_attr($tab_id) . '">' . esc_html($t['tab_title']) . '</a>'; } echo '</div>'; } // $name = $args['id']; $i = 1; foreach ($st_meta_box_opts as $tab_id => $tab) { $name = $tab['name']; $class = $i == 1 ? ' active' : ' tab-hide'; $i++; $values = get_post_meta($post->ID, $name, true); echo '<input type="hidden" name="st_meta_box_names[]" value="', esc_attr($name), '" />';
</li> <?php } ?> </ul> <div id="save_sidebar"> <input type="submit" class="button-primary" value="<?php _e('Save All Changes', 'smooththemes'); ?> " /> </div> </div><!-- STpanel-tabs --> <div class="STpanel-content"> <?php $tab_display = new admin_tabs_display($values); foreach ($tabs_settings->tabs as $tab) { ?> <div id="<?php echo $tab['tab_id']; ?> " class="STpanel-tab"> <?php $tab_display->display_tab_contents($tab['fields']); ?> </div> <?php } // end foreach tab ?> </div><!-- STpanel-content-->