$post_type); add_meta_box( 'authorsure-visibility', 'AuthorSure Settings', array( AUTHORSURE_POST, 'visibility_panel' ), $page, 'advanced', 'low' ,$vars); global $current_screen; if (method_exists($current_screen,'add_help_tab')) { $current_screen->add_help_tab( array( 'id' => 'authorsure_help_tab', 'title' => __('AuthorSure Settings'), 'content' => __( '
In the AuthorSure Settings section below you can choose whether to enable or disable AuthorSure links on this page. For example, you might want to disable the author links on contact, privacy statement and terms and conditions pages, and on posts with recipe microformats.
')) ); } } } static function visibility_panel($post,$metabox) { global $post; $post_type = $metabox['args']['post_type']; switch ($post_type) { case 'post' : $showtime = false; break; //option is always to hide on posts as it is present by default case 'page' : $showtime = AUTHORSURE::get_option('hide_box_on_pages') ; break;//option on page depends on default default: $showtime = true; //option is always to show on custom post types as it is absent by default } $key = $showtime ? AUTHORSURE::get_show_author_box_key() : AUTHORSURE::get_hide_author_box_key(); $toggle = get_post_meta($post->ID, $key, true); $author_box_toggle = $toggle?' checked="checked"':''; $action = $showtime ? 'show' : 'hide'; $label = __($showtime ? 'enable author links on this page' : 'disable author links on this page'); print <<< AUTHORSURE_VISIBILITY AUTHORSURE_VISIBILITY; } static function save($post_id) { if (array_key_exists('authorsure_toggle_action', $_POST)) { $key = 'show'==$_POST['authorsure_toggle_action'] ? AUTHORSURE::get_show_author_box_key() : AUTHORSURE::get_hide_author_box_key(); $val = array_key_exists($key, $_POST) ? $_POST[$key] : false; update_post_meta( $post_id, $key, $val ); } update_post_meta( $post_id, AUTHORSURE::get_include_css_key(), strpos(get_post_field('post_content', $post_id),'[authorsure') !== FALSE); } } ?>