ID, 'disable_title', true ); $disable_feat_image = get_post_meta( $post->ID, 'disable_feat_image', true ); $disable_space = get_post_meta( $post->ID, 'disable_space', true ); $disable_sidebar_only = get_post_meta( $post->ID, 'disable_sidebar_only', true ); $disable_sidebar = get_post_meta( $post->ID, 'disable_sidebar', true ); // Set default values. if( empty( $disable_title ) ) $disable_title = ''; if( empty( $disable_feat_image ) ) $disable_feat_image = ''; if( empty( $disable_space ) ) $disable_space = ''; if( empty( $disable_sidebar_only ) ) $disable_sidebar_only = ''; if( empty( $disable_sidebar ) ) $disable_sidebar = ''; // Form fields. echo '
'; // For disable title echo '
'; echo ''; echo '
'; // For disable feature image echo '
'; echo ''; echo '
'; // For disable space echo '
'; echo ''; echo '
'; // For disable sidebar only echo '
'; echo ''; echo '
'; // For disable sidebar and background echo '
'; echo ''; echo '
'; echo '
'; /*.blog-kit-elements-disable-wrap*/ } public function save_metabox( $post_id, $post ) { // Check if a nonce is set. if ( ! isset( $_POST['blog_kit_disable_elements_nonce'] ) ) return; // Check if a nonce is valid. if ( ! wp_verify_nonce( $_POST['blog_kit_disable_elements_nonce'], 'blog_kit_disable_elements_nonce_action' ) ) return; // Check if the user has permissions to save data. if ( ! current_user_can( 'edit_post', $post_id ) ) return; // Check if it's not an autosave. if ( wp_is_post_autosave( $post_id ) ) return; // Check if it's not a revision. if ( wp_is_post_revision( $post_id ) ) return; // Sanitize user input. $disable_title_new = isset( $_POST[ 'disable_title' ] ) ? 'checked' : ''; $disable_feat_image_new = isset( $_POST[ 'disable_feat_image' ] ) ? 'checked' : ''; $disable_space_new = isset( $_POST[ 'disable_space' ] ) ? 'checked' : ''; $disable_sidebar_only_new = isset( $_POST[ 'disable_sidebar_only' ] ) ? 'checked' : ''; $disable_sidebar_new = isset( $_POST[ 'disable_sidebar' ] ) ? 'checked' : ''; // Update the meta field in the database. update_post_meta( $post_id, 'disable_title', $disable_title_new ); update_post_meta( $post_id, 'disable_feat_image', $disable_feat_image_new ); update_post_meta( $post_id, 'disable_space', $disable_space_new ); update_post_meta( $post_id, 'disable_sidebar_only', $disable_sidebar_only_new ); update_post_meta( $post_id, 'disable_sidebar', $disable_sidebar_new ); } } new Blog_Kit_Settings_Meta_Box;