ID, 'enable_transparent_header', true );
// Set default values.
if( empty( $enable_transparent_header ) ) $enable_transparent_header = '';
// Form fields.
echo '
';
// For disable title
echo '
';
echo '';
echo '
';
echo '
'; /*.best-hotel-elements-disable-wrap*/
}
public function save_metabox( $post_id, $post ) {
// Check if a nonce is set.
if ( ! isset( $_POST['best_hotel_disable_elements_nonce'] ) )
return;
// Check if a nonce is valid.
if ( ! wp_verify_nonce( $_POST['best_hotel_disable_elements_nonce'], 'best_hotel_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.
$enable_transparent_header_new = isset( $_POST[ 'enable_transparent_header' ] ) ? 'checked' : '';
// Update the meta field in the database.
update_post_meta( $post_id, 'enable_transparent_header', $enable_transparent_header_new );
}
}
new best_hotel_Settings_Meta_Box;