Enable "Screen Options" menu to show/hide metaboxes in options page

Note: To enable "Screen Options" menu, some function parameters should be as follows.

 * If `$menu_slug` in [http://codex.wordpress.org/Function_Reference/add_options_page add_options_page()] is 'my-unique-identifier',
   * `$post_type` in [http://codex.wordpress.org/Function_Reference/add_meta_box add_meta_box()] should be '**settings_page_**my-unique-identifier'
   * `$page` in [http://codex.wordpress.org/Function_Reference/do_meta_boxes do_meta_boxes()] should be same value as `$post_type` above
This commit is contained in:
attosoft committed 2012-05-30 07:18:43 +00:00
1 parent ef5b176cec
commit 27299fbfc2
1 file changed
+8 -8
+8 -8
View File
@@ -11,13 +11,13 @@ class auto_thickbox_options {
// Auto ThickBox Plus Options
function register_options_page() {
add_options_page($this->texts['options'], AUTO_THICKBOX_PLUS, 'manage_options', $this->base_dir, array(&$this, 'options_page'));
add_meta_box( 'general-box', __('General'), array(&$this, 'general_metabox'), 'auto-thickbox-options', 'normal' );
add_meta_box( 'action-box', $this->texts['action'], array(&$this, 'action_metabox'), 'auto-thickbox-options', 'normal' );
add_meta_box( 'view-box', $this->texts['view'], array(&$this, 'view_metabox'), 'auto-thickbox-options', 'normal' );
add_meta_box( 'text-box', __('Text'), array(&$this, 'text_metabox'), 'auto-thickbox-options', 'normal' );
add_meta_box( 'image-box', $this->texts['image'], array(&$this, 'image_metabox'), 'auto-thickbox-options', 'normal' );
add_meta_box( 'effect-box', __('Effect', 'auto-thickbox') . ' (' . __('beta', 'auto-thickbox') . ')', array(&$this, 'effect_metabox'), 'auto-thickbox-options', 'normal' );
add_meta_box( 'about-box', $this->texts['about'], array(&$this, 'about_metabox'), 'auto-thickbox-options', 'normal' );
add_meta_box( 'general-box', __('General'), array(&$this, 'general_metabox'), 'settings_page_auto-thickbox-plus', 'normal' );
add_meta_box( 'action-box', $this->texts['action'], array(&$this, 'action_metabox'), 'settings_page_auto-thickbox-plus', 'normal' );
add_meta_box( 'view-box', $this->texts['view'], array(&$this, 'view_metabox'), 'settings_page_auto-thickbox-plus', 'normal' );
add_meta_box( 'text-box', __('Text'), array(&$this, 'text_metabox'), 'settings_page_auto-thickbox-plus', 'normal' );
add_meta_box( 'image-box', $this->texts['image'], array(&$this, 'image_metabox'), 'settings_page_auto-thickbox-plus', 'normal' );
add_meta_box( 'effect-box', __('Effect', 'auto-thickbox') . ' (' . __('beta', 'auto-thickbox') . ')', array(&$this, 'effect_metabox'), 'settings_page_auto-thickbox-plus', 'normal' );
add_meta_box( 'about-box', $this->texts['about'], array(&$this, 'about_metabox'), 'settings_page_auto-thickbox-plus', 'normal' );
if (isset($_SERVER['HTTP_REFERER']) && strpos($_SERVER['HTTP_REFERER'], 'post_id=' . $this->options['post_id']) !== false) {
add_filter('gettext', array(&$this, 'replace_insert_button'), 20, 3);
register_post_type('auto-thickbox-plus', array('label' => AUTO_THICKBOX_PLUS));
@@ -50,7 +50,7 @@ class auto_thickbox_options {
<?php
wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false );
wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false );
do_meta_boxes( 'auto-thickbox-options', 'normal', null );
do_meta_boxes( 'settings_page_auto-thickbox-plus', 'normal', null );
?>
</div>
<p class="submit">