'array', 'description' => '', 'sanitize_callback' => [ $sanitization, 'sanitize_for_options' ], 'show_in_rest' => false, 'default' => array(), ) ); // ================================================================= // Call WordPress globals and set new globals required for the fields // ================================================================= global $wp_roles, $wpdb, $asenha_public_post_types, $asenha_gutenberg_post_types, $asenha_revisions_post_types ; $roles = $wp_roles->get_names(); // Get array of slugs and plural labels for public post types, e.g. array( 'post' => 'Posts', 'page' => 'Pages' ) $asenha_public_post_types = array(); $public_post_type_names = get_post_types( array( 'public' => true, ), 'names' ); foreach ( $public_post_type_names as $post_type_name ) { $post_type_object = get_post_type_object( $post_type_name ); $asenha_public_post_types[$post_type_name] = $post_type_object->label; } // Get array of slugs and plural labels for post types that can be edited with the Gutenberg block editor, e.g. array( 'post' => 'Posts', 'page' => 'Pages' ) $asenha_gutenberg_post_types = array(); $gutenberg_not_applicable_types = array( 'attachment', 'revision', 'nav_menu_item', 'custom_css', 'customize_changeset', 'oembed_cache', 'user_request', 'wp_block' ); $all_post_types = get_post_types( array(), 'objects' ); foreach ( $all_post_types as $post_type_slug => $post_type_info ) { $asenha_gutenberg_post_types[$post_type_slug] = $post_type_info->label; if ( in_array( $post_type_slug, $gutenberg_not_applicable_types ) ) { unset( $asenha_gutenberg_post_types[$post_type_slug] ); } } // Get array of slugs and plural labels for post types supporting revisions, e.g. array( 'post' => 'Posts', 'page' => 'Pages' ) $asenha_revisions_post_types = array(); foreach ( get_post_types( array(), 'names' ) as $post_type_slug ) { // post type slug/name if ( post_type_supports( $post_type_slug, 'revisions' ) ) { $post_type_object = get_post_type_object( $post_type_slug ); if ( property_exists( $post_type_object, 'label' ) ) { $asenha_revisions_post_types[$post_type_slug] = $post_type_object->label; } } } // Enable Content Duplication $field_id = 'enable_duplication'; $field_slug = 'enable-duplication'; add_settings_field( $field_id, // Field ID 'Content Duplication', // Field title [ $render_field, 'render_checkbox_toggle' ], // Callback to render field with custom arguments in the array below ASENHA_SLUG, // Settings page slug 'main-section', // Section ID array( 'option_name' => ASENHA_SLUG_U, 'field_id' => $field_id, 'field_slug' => $field_slug, 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']', 'field_description' => 'Enable one-click duplication of pages, posts and custom posts. The corresponding taxonomy terms and post meta will also be duplicated.', 'class' => 'asenha-toggle content-management ' . $field_slug, ) ); // Content Order $field_id = 'content_order'; $field_slug = 'content-order'; add_settings_field( $field_id, // Field ID 'Content Order', // Field title [ $render_field, 'render_checkbox_toggle' ], // Callback to render field with custom arguments in the array below ASENHA_SLUG, // Settings page slug 'main-section', // Section ID array( 'option_name' => ASENHA_SLUG_U, 'field_id' => $field_id, 'field_slug' => $field_slug, 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']', 'field_description' => 'Enable custom ordering of various "hierarchical" content types or those supporting "page attributes". Useful for displaying them in the desired order in wp-admin and on the frontend.', 'field_options_wrapper' => true, 'field_options_moreless' => true, 'class' => 'asenha-toggle content-management ' . $field_slug, ) ); // $field_id = 'content_order_subfields_heading'; // $field_slug = 'content-order-subfields-heading'; // add_settings_field( // $field_id, // Field ID // '', // Field title // [ $render_field, 'render_subfields_heading' ], // Callback to render field with custom arguments in the array below // ASENHA_SLUG, // Settings page slug // 'main-section', // Section ID // array( // 'subfields_heading' => 'Custom Post Types (Non-Hierarchical)', // Custom argument // 'class' => 'asenha-heading shift-more-up content-management ' . $field_slug, // Custom class for the element // ) // ); $field_id = 'content_order_for'; $field_slug = 'content-order-for'; if ( is_array( $asenha_public_post_types ) ) { foreach ( $asenha_public_post_types as $post_type_slug => $post_type_label ) { // e.g. $post_type_slug is post, $post_type_label is Posts $is_hierarchical_label = ( is_post_type_hierarchical( $post_type_slug ) ? ' - Hierarchical' : '' ); if ( post_type_supports( $post_type_slug, 'page-attributes' ) || is_post_type_hierarchical( $post_type_slug ) ) { add_settings_field( $field_id . '_' . $post_type_slug, // Field ID '', // Field title [ $render_field, 'render_checkbox_subfield' ], // Callback to render field with custom arguments in the array below ASENHA_SLUG, // Settings page slug 'main-section', // Section ID array( 'option_name' => ASENHA_SLUG_U, 'parent_field_id' => $field_id, 'field_id' => $post_type_slug, 'field_name' => ASENHA_SLUG_U . '[' . $field_id . '][' . $post_type_slug . ']', 'field_label' => $post_type_label . ' (' . $post_type_slug . ')' . $is_hierarchical_label, 'class' => 'asenha-checkbox asenha-hide-th asenha-half content-management ' . $field_slug . ' ' . $post_type_slug, ) ); } } } // Enable Media Replacement $field_id = 'enable_media_replacement'; $field_slug = 'enable-media-replacement'; add_settings_field( $field_id, // Field ID 'Media Replacement', // Field title [ $render_field, 'render_checkbox_toggle' ], // Callback to render field with custom arguments in the array below ASENHA_SLUG, // Settings page slug 'main-section', // Section ID array( 'option_name' => ASENHA_SLUG_U, 'field_id' => $field_id, 'field_slug' => $field_slug, 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']', 'field_description' => 'Easily replace any type of media file with a new one while retaining the existing media ID, publish date and file name. So, no existing links will break.', 'class' => 'asenha-toggle content-management ' . $field_slug, ) ); // Enable SVG Upload $field_id = 'enable_svg_upload'; $field_slug = 'enable-svg-upload'; add_settings_field( $field_id, // Field ID 'SVG Upload', // Field title [ $render_field, 'render_checkbox_toggle' ], // Callback to render field with custom arguments in the array below ASENHA_SLUG, // Settings page slug 'main-section', // Section ID array( 'option_name' => ASENHA_SLUG_U, 'field_id' => $field_id, 'field_slug' => $field_slug, 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']', 'field_description' => 'Allow some or all user roles to upload SVG files, which will then be sanitized to keep things secure.', 'field_options_wrapper' => true, 'field_options_moreless' => true, 'class' => 'asenha-toggle content-management ' . $field_slug, ) ); $field_id = 'enable_svg_upload_for'; $field_slug = 'enable-svg-upload-for'; if ( is_array( $roles ) ) { foreach ( $roles as $role_slug => $role_label ) { // e.g. $role_slug is administrator, $role_label is Administrator add_settings_field( $field_id . '_' . $role_slug, // Field ID '', // Field title [ $render_field, 'render_checkbox_subfield' ], // Callback to render field with custom arguments in the array below ASENHA_SLUG, // Settings page slug 'main-section', // Section ID array( 'option_name' => ASENHA_SLUG_U, 'parent_field_id' => $field_id, 'field_id' => $role_slug, 'field_name' => ASENHA_SLUG_U . '[' . $field_id . '][' . $role_slug . ']', 'field_label' => $role_label, 'class' => 'asenha-checkbox asenha-hide-th asenha-half admin-interface ' . $field_slug . ' ' . $role_slug, ) ); } } // Enable External Permalinks $field_id = 'enable_external_permalinks'; $field_slug = 'enable-external-permalinks'; add_settings_field( $field_id, // Field ID 'External Permalinks', // Field title [ $render_field, 'render_checkbox_toggle' ], // Callback to render field with custom arguments in the array below ASENHA_SLUG, // Settings page slug 'main-section', // Section ID array( 'option_name' => ASENHA_SLUG_U, 'field_id' => $field_id, 'field_slug' => $field_slug, 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']', 'field_description' => 'Enable pages, posts and/or custom post types to have permalinks that point to external URLs. The rel="noopener noreferrer nofollow" attribute will also be added for enhanced security and SEO benefits. Compatible with links added using Page Links To.', 'field_options_wrapper' => true, 'field_options_moreless' => true, 'class' => 'asenha-toggle content-management ' . $field_slug, ) ); $field_id = 'enable_external_permalinks_for'; $field_slug = 'enable-external-permalinks-for'; if ( is_array( $asenha_public_post_types ) ) { foreach ( $asenha_public_post_types as $post_type_slug => $post_type_label ) { // e.g. $post_type_slug is post, $post_type_label is Posts if ( 'attachment' != $post_type_slug ) { add_settings_field( $field_id . '_' . $post_type_slug, // Field ID '', // Field title [ $render_field, 'render_checkbox_subfield' ], // Callback to render field with custom arguments in the array below ASENHA_SLUG, // Settings page slug 'main-section', // Section ID array( 'option_name' => ASENHA_SLUG_U, 'parent_field_id' => $field_id, 'field_id' => $post_type_slug, 'field_name' => ASENHA_SLUG_U . '[' . $field_id . '][' . $post_type_slug . ']', 'field_label' => $post_type_label . ' (' . $post_type_slug . ')', 'class' => 'asenha-checkbox asenha-hide-th asenha-half content-management ' . $field_slug . ' ' . $post_type_slug, ) ); } } } // Open All External Links in New Tab $field_id = 'external_links_new_tab'; $field_slug = 'external-links-new-tab'; add_settings_field( $field_id, // Field ID 'Open All External Links in New Tab', // Field title [ $render_field, 'render_checkbox_toggle' ], // Callback to render field with custom arguments in the array below ASENHA_SLUG, // Settings page slug 'main-section', // Section ID array( 'option_name' => ASENHA_SLUG_U, 'field_id' => $field_id, 'field_slug' => $field_slug, 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']', 'field_description' => 'Force all links to external sites to open in new browser tab via target="_blank" attribute. The rel="noopener noreferrer nofollow" attribute will also be added for enhanced security and SEO benefits.', 'field_options_wrapper' => true, 'field_options_moreless' => true, 'class' => 'asenha-toggle content-management ' . $field_slug, ) ); // Enable Auto-Publishing of Posts with Missed Schedules $field_id = 'enable_missed_schedule_posts_auto_publish'; $field_slug = 'enable-missed-schedule-posts-auto-publish'; add_settings_field( $field_id, // Field ID 'Auto-Publish Posts with Missed Schedule', // Field title [ $render_field, 'render_checkbox_toggle' ], // Callback to render field with custom arguments in the array below ASENHA_SLUG, // Settings page slug 'main-section', // Section ID array( 'option_name' => ASENHA_SLUG_U, 'field_id' => $field_id, 'field_slug' => $field_slug, 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']', 'field_description' => 'Trigger publishing of scheduled posts of all types marked with "missed schedule", anytime the site is visited.', 'class' => 'asenha-toggle content-management ' . $field_slug, ) ); // Enhance List Tables $field_id = 'enhance_list_tables'; $field_slug = 'enhance-list-tables'; add_settings_field( $field_id, // Field ID 'Enhance List Tables', // Field title [ $render_field, 'render_checkbox_toggle' ], // Callback to render field with custom arguments in the array below ASENHA_SLUG, // Settings page slug 'main-section', // Section ID array( 'option_name' => ASENHA_SLUG_U, 'field_id' => $field_id, 'field_slug' => $field_slug, 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']', 'field_description' => 'Improve the usefulness of listing pages for various post types and taxonomies, media, comments and users by adding / removing columns and elements.', 'field_options_wrapper' => true, 'field_options_moreless' => true, 'class' => 'asenha-toggle content-management ' . $field_slug, ) ); // Show Featured Image Column $field_id = 'show_featured_image_column'; $field_slug = 'show-featured-image-column'; add_settings_field( $field_id, // Field ID '', // Field title [ $render_field, 'render_checkbox_plain' ], // Callback to render field with custom arguments in the array below ASENHA_SLUG, // Settings page slug 'main-section', // Section ID array( 'option_name' => ASENHA_SLUG_U, 'field_id' => $field_id, 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']', 'field_label' => 'Show featured image column.', 'class' => 'asenha-checkbox asenha-hide-th content-management ' . $field_slug, ) ); // Show Excerpt Column $field_id = 'show_excerpt_column'; $field_slug = 'show-excerpt-column'; add_settings_field( $field_id, // Field ID '', // Field title [ $render_field, 'render_checkbox_plain' ], // Callback to render field with custom arguments in the array below ASENHA_SLUG, // Settings page slug 'main-section', // Section ID array( 'option_name' => ASENHA_SLUG_U, 'field_id' => $field_id, 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']', 'field_label' => 'Show excerpt column.', 'class' => 'asenha-checkbox asenha-hide-th content-management ' . $field_slug, ) ); // Show ID Column $field_id = 'show_id_column'; $field_slug = 'show-id-column'; add_settings_field( $field_id, // Field ID '', // Field title [ $render_field, 'render_checkbox_plain' ], // Callback to render field with custom arguments in the array below ASENHA_SLUG, // Settings page slug 'main-section', // Section ID array( 'option_name' => ASENHA_SLUG_U, 'field_id' => $field_id, 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']', 'field_label' => 'Show ID column.', 'class' => 'asenha-checkbox asenha-hide-th content-management ' . $field_slug, ) ); // Show ID in Action Row $field_id = 'show_id_in_action_row'; $field_slug = 'show-id-in-action_row'; add_settings_field( $field_id, // Field ID '', // Field title [ $render_field, 'render_checkbox_plain' ], // Callback to render field with custom arguments in the array below ASENHA_SLUG, // Settings page slug 'main-section', // Section ID array( 'option_name' => ASENHA_SLUG_U, 'field_id' => $field_id, 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']', 'field_label' => 'Show ID in action rows along with links for Edit, View, etc.', 'class' => 'asenha-checkbox asenha-hide-th content-management ' . $field_slug, ) ); // Show Custom Taxonomy Filters $field_id = 'show_custom_taxonomy_filters'; $field_slug = 'show-custom-taxonomy-filters'; add_settings_field( $field_id, // Field ID '', // Field title [ $render_field, 'render_checkbox_plain' ], // Callback to render field with custom arguments in the array below ASENHA_SLUG, // Settings page slug 'main-section', // Section ID array( 'option_name' => ASENHA_SLUG_U, 'field_id' => $field_id, 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']', 'field_label' => 'Show additional filter(s) for hierarchical, custom taxonomies.', 'class' => 'asenha-checkbox asenha-hide-th content-management ' . $field_slug, ) ); // Hide Comments Column $field_id = 'hide_comments_column'; $field_slug = 'hide-comments-column'; add_settings_field( $field_id, // Field ID '', // Field title [ $render_field, 'render_checkbox_plain' ], // Callback to render field with custom arguments in the array below ASENHA_SLUG, // Settings page slug 'main-section', // Section ID array( 'option_name' => ASENHA_SLUG_U, 'field_id' => $field_id, 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']', 'field_label' => 'Remove comments column.', 'class' => 'asenha-checkbox asenha-hide-th content-management ' . $field_slug, ) ); // Hide Post Tags Column $field_id = 'hide_post_tags_column'; $field_slug = 'hide-post-tags-column'; add_settings_field( $field_id, // Field ID '', // Field title [ $render_field, 'render_checkbox_plain' ], // Callback to render field with custom arguments in the array below ASENHA_SLUG, // Settings page slug 'main-section', // Section ID array( 'option_name' => ASENHA_SLUG_U, 'field_id' => $field_id, 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']', 'field_label' => 'Remove tags column (for posts).', 'class' => 'asenha-checkbox asenha-hide-th content-management ' . $field_slug, ) ); // ================================================================= // ADMIN INTERFACE // ================================================================= // Hide Admin Notices $field_id = 'hide_admin_notices'; $field_slug = 'hide-admin-notices'; add_settings_field( $field_id, // Field ID 'Hide Admin Notices', // Field title [ $render_field, 'render_checkbox_toggle' ], // Callback to render field with custom arguments in the array below ASENHA_SLUG, // Settings page slug 'main-section', // Section ID array( 'option_name' => ASENHA_SLUG_U, 'field_id' => $field_id, 'field_slug' => $field_slug, 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']', 'field_description' => 'Clean up admin pages by moving notices into a separate panel easily accessible via the admin bar.', 'class' => 'asenha-toggle admin-interface ' . $field_slug, ) ); // Disable Dashboard Widgets $field_id = 'disable_dashboard_widgets'; $field_slug = 'disable-dashboard-widgets'; add_settings_field( $field_id, // Field ID 'Disable Dashboard Widgets', // Field title [ $render_field, 'render_checkbox_toggle' ], // Callback to render field with custom arguments in the array below ASENHA_SLUG, // Settings page slug 'main-section', // Section ID array( 'option_name' => ASENHA_SLUG_U, 'field_id' => $field_id, 'field_slug' => $field_slug, 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']', 'field_description' => 'Clean up and speed up the dashboard by completely disabling some or all widgets. Disabled widgets won\'t load any assets nor show up under Screen Options. ', 'field_options_wrapper' => true, 'field_options_moreless' => true, 'class' => 'asenha-toggle admin-interface ' . $field_slug, ) ); $field_id = 'disabled_dashboard_widgets'; $field_slug = 'disabled-dashboard-widgets'; $extra_options = get_option( 'admin_site_enhancements_extra', array() ); if ( array_key_exists( 'dashboard_widgets', $extra_options ) ) { $dashboard_widgets = $extra_options['dashboard_widgets']; } else { $admin_interface = new Admin_Interface(); $dashboard_widgets = $admin_interface->get_dashboard_widgets(); $extra_options['dashboard_widgets'] = $dashboard_widgets; update_option( 'admin_site_enhancements_extra', $extra_options ); } foreach ( $dashboard_widgets as $widget ) { add_settings_field( $field_id . '_' . $widget['id'], // Field ID '', // Field title [ $render_field, 'render_checkbox_subfield' ], // Callback to render field with custom arguments in the array below ASENHA_SLUG, // Settings page slug 'main-section', // Section ID array( 'option_name' => ASENHA_SLUG_U, 'parent_field_id' => $field_id, 'field_id' => $widget['id'] . '__' . $widget['context'] . '__' . $widget['priority'], 'field_name' => ASENHA_SLUG_U . '[' . $field_id . '][' . $widget['id'] . '__' . $widget['context'] . '__' . $widget['priority'] . ']', 'field_label' => $widget['title'] . ' (' . $widget['id'] . ')', 'class' => 'asenha-checkbox asenha-hide-th admin-interface ' . $field_slug . ' ' . $widget['id'], ) ); } // Hide or Modify Elements $field_id = 'hide_modify_elements'; $field_slug = 'hide-modify-elements'; add_settings_field( $field_id, // Field ID 'Clean Up Admin Bar', // Field title [ $render_field, 'render_checkbox_toggle' ], // Callback to render field with custom arguments in the array below ASENHA_SLUG, // Settings page slug 'main-section', // Section ID array( 'option_name' => ASENHA_SLUG_U, 'field_id' => $field_id, 'field_slug' => $field_slug, 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']', 'field_description' => 'Remove various elements from the admin bar.', 'field_options_wrapper' => true, 'field_options_moreless' => true, 'class' => 'asenha-toggle admin-interface ' . $field_slug, ) ); $field_id = 'hide_ab_wp_logo_menu'; $field_slug = 'hide-ab-wp-logo-menu'; add_settings_field( $field_id, // Field ID '', // Field title [ $render_field, 'render_checkbox_plain' ], // Callback to render field with custom arguments in the array below ASENHA_SLUG, // Settings page slug 'main-section', // Section ID array( 'option_name' => ASENHA_SLUG_U, 'field_id' => $field_id, 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']', 'field_label' => 'Remove WordPress logo/menu', 'class' => 'asenha-checkbox asenha-hide-th admin-interface ' . $field_slug, ) ); $field_id = 'hide_ab_customize_menu'; $field_slug = 'hide-ab-customize-menu'; add_settings_field( $field_id, // Field ID '', // Field title [ $render_field, 'render_checkbox_plain' ], // Callback to render field with custom arguments in the array below ASENHA_SLUG, // Settings page slug 'main-section', // Section ID array( 'option_name' => ASENHA_SLUG_U, 'field_id' => $field_id, 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']', 'field_label' => 'Remove customize menu', 'class' => 'asenha-checkbox asenha-hide-th admin-interface ' . $field_slug, ) ); $field_id = 'hide_ab_updates_menu'; $field_slug = 'hide-ab-updates-menu'; add_settings_field( $field_id, // Field ID '', // Field title [ $render_field, 'render_checkbox_plain' ], // Callback to render field with custom arguments in the array below ASENHA_SLUG, // Settings page slug 'main-section', // Section ID array( 'option_name' => ASENHA_SLUG_U, 'field_id' => $field_id, 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']', 'field_label' => 'Remove updates counter/link', 'class' => 'asenha-checkbox asenha-hide-th admin-interface ' . $field_slug, ) ); $field_id = 'hide_ab_comments_menu'; $field_slug = 'hide-ab-comments-menu'; add_settings_field( $field_id, // Field ID '', // Field title [ $render_field, 'render_checkbox_plain' ], // Callback to render field with custom arguments in the array below ASENHA_SLUG, // Settings page slug 'main-section', // Section ID array( 'option_name' => ASENHA_SLUG_U, 'field_id' => $field_id, 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']', 'field_label' => 'Remove comments counter/link', 'class' => 'asenha-checkbox asenha-hide-th admin-interface ' . $field_slug, ) ); $field_id = 'hide_ab_new_content_menu'; $field_slug = 'hide-ab-new-content-menu'; add_settings_field( $field_id, // Field ID '', // Field title [ $render_field, 'render_checkbox_plain' ], // Callback to render field with custom arguments in the array below ASENHA_SLUG, // Settings page slug 'main-section', // Section ID array( 'option_name' => ASENHA_SLUG_U, 'field_id' => $field_id, 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']', 'field_label' => 'Remove new content menu', 'class' => 'asenha-checkbox asenha-hide-th admin-interface ' . $field_slug, ) ); $field_id = 'hide_ab_howdy'; $field_slug = 'hide-ab-howdy'; add_settings_field( $field_id, // Field ID '', // Field title [ $render_field, 'render_checkbox_plain' ], // Callback to render field with custom arguments in the array below ASENHA_SLUG, // Settings page slug 'main-section', // Section ID array( 'option_name' => ASENHA_SLUG_U, 'field_id' => $field_id, 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']', 'field_label' => 'Remove \'Howdy\'', 'class' => 'asenha-checkbox asenha-hide-th admin-interface ' . $field_slug, ) ); $field_id = 'hide_help_drawer'; $field_slug = 'hide-help-drawer'; add_settings_field( $field_id, // Field ID '', // Field title [ $render_field, 'render_checkbox_plain' ], // Callback to render field with custom arguments in the array below ASENHA_SLUG, // Settings page slug 'main-section', // Section ID array( 'option_name' => ASENHA_SLUG_U, 'field_id' => $field_id, 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']', 'field_label' => 'Remove the Help tab and drawer', 'class' => 'asenha-checkbox asenha-hide-th admin-interface ' . $field_slug, ) ); // Hide Admin Bar $field_id = 'hide_admin_bar'; $field_slug = 'hide-admin-bar'; add_settings_field( $field_id, // Field ID 'Hide Admin Bar', // Field title [ $render_field, 'render_checkbox_toggle' ], // Callback to render field with custom arguments in the array below ASENHA_SLUG, // Settings page slug 'main-section', // Section ID array( 'option_name' => ASENHA_SLUG_U, 'field_id' => $field_id, 'field_slug' => $field_slug, 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']', 'field_description' => 'Hide admin bar on the front end for all or some user roles.', 'field_options_wrapper' => true, 'field_options_moreless' => true, 'class' => 'asenha-toggle admin-interface ' . $field_slug, ) ); $field_id = 'hide_admin_bar_for'; $field_slug = 'hide-admin-bar-for'; if ( is_array( $roles ) ) { foreach ( $roles as $role_slug => $role_label ) { // e.g. $role_slug is administrator, $role_label is Administrator add_settings_field( $field_id . '_' . $role_slug, // Field ID '', // Field title [ $render_field, 'render_checkbox_subfield' ], // Callback to render field with custom arguments in the array below ASENHA_SLUG, // Settings page slug 'main-section', // Section ID array( 'option_name' => ASENHA_SLUG_U, 'parent_field_id' => $field_id, 'field_id' => $role_slug, 'field_name' => ASENHA_SLUG_U . '[' . $field_id . '][' . $role_slug . ']', 'field_label' => $role_label, 'class' => 'asenha-checkbox asenha-hide-th asenha-half admin-interface ' . $field_slug . ' ' . $role_slug, ) ); } } // Wider Admin Menu $field_id = 'wider_admin_menu'; $field_slug = 'wider-admin-menu'; add_settings_field( $field_id, // Field ID 'Wider Admin Menu', // Field title [ $render_field, 'render_checkbox_toggle' ], // Callback to render field with custom arguments in the array below ASENHA_SLUG, // Settings page slug 'main-section', // Section ID array( 'option_name' => ASENHA_SLUG_U, 'field_id' => $field_id, 'field_slug' => $field_slug, 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']', 'field_description' => 'Give the admin menu more room to better accommodate wider items.', 'field_options_wrapper' => true, 'class' => 'asenha-toggle admin-interface ' . $field_slug, ) ); $field_id = 'admin_menu_width'; $field_slug = 'admin-menu-width'; add_settings_field( $field_id, // Field ID '', // Field title [ $render_field, 'render_select_subfield' ], // Callback to render field with custom arguments in the array below ASENHA_SLUG, // Settings page slug 'main-section', // Section ID array( 'option_name' => ASENHA_SLUG_U, 'field_id' => $field_id, 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']', 'field_type' => 'with-prefix-suffix', 'field_prefix' => 'Set width to', 'field_suffix' => '(Default is 160px)', 'field_select_options' => array( '180px' => '180px', '200px' => '200px', '220px' => '220px', '240px' => '240px', '260px' => '260px', '280px' => '280px', '300px' => '300px', ), 'field_select_default' => 200, 'field_intro' => '', 'field_description' => '', 'class' => 'asenha-number asenha-hide-th extra-narrow shift-up admin-interface ' . $field_slug, 'display_none_on_load' => true, ) ); // Admin Menu Organizer $field_id = 'customize_admin_menu'; $field_slug = 'customize-admin-menu'; add_settings_field( $field_id, // Field ID 'Admin Menu Organizer', // Field title [ $render_field, 'render_checkbox_toggle' ], // Callback to render field with custom arguments in the array below ASENHA_SLUG, // Settings page slug 'main-section', // Section ID array( 'option_name' => ASENHA_SLUG_U, 'field_id' => $field_id, 'field_slug' => $field_slug, 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']', 'field_description' => 'Customize the order of the admin menu and optionally change menu item title or hide some items.', 'field_options_wrapper' => true, 'field_options_moreless' => true, 'class' => 'asenha-toggle admin-interface ' . $field_slug, ) ); $field_id = 'custom_menu_order'; $field_slug = 'custom-menu-order'; add_settings_field( $field_id, // Field ID '', // Field title [ $render_field, 'render_sortable_menu' ], // Callback to render field with custom arguments in the array below ASENHA_SLUG, // Settings page slug 'main-section', // Section ID array( 'option_name' => ASENHA_SLUG_U, 'field_id' => $field_id, 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']', 'field_type' => 'sortable-menu', 'field_description' => '', 'class' => 'asenha-sortable asenha-hide-th admin-interface ' . $field_slug, ) ); // ================================================================= // LOG IN | LOG OUT // ================================================================= // Change Login URL $field_id = 'change_login_url'; $field_slug = 'change-login-url'; add_settings_field( $field_id, // Field ID 'Change Login URL', // Field title [ $render_field, 'render_checkbox_toggle' ], // Callback to render field with custom arguments in the array below ASENHA_SLUG, // Settings page slug 'main-section', // Section ID array( 'option_name' => ASENHA_SLUG_U, 'field_id' => $field_id, 'field_slug' => $field_slug, 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']', 'field_description' => 'Default is ' . get_site_url() . '/wp-login.php', 'field_options_wrapper' => true, 'class' => 'asenha-toggle login-logout ' . $field_slug, ) ); $field_id = 'custom_login_slug'; $field_slug = 'custom-login-slug'; add_settings_field( $field_id, // Field ID 'New URL:', // Field title [ $render_field, 'render_text_subfield' ], // Callback to render field with custom arguments in the array below ASENHA_SLUG, // Settings page slug 'main-section', // Section ID array( 'option_name' => ASENHA_SLUG_U, 'field_id' => $field_id, 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']', 'field_type' => 'with-prefix-suffix', 'field_prefix' => get_site_url() . '/', 'field_suffix' => '', 'field_description' => '', 'class' => 'asenha-text with-prefix-suffix login-logout ' . $field_slug, ) ); // Enable Log In/Out Menu $field_id = 'enable_login_logout_menu'; $field_slug = 'enable-login-logout-menu'; add_settings_field( $field_id, // Field ID 'Log In/Out Menu', // Field title [ $render_field, 'render_checkbox_toggle' ], // Callback to render field with custom arguments in the array below ASENHA_SLUG, // Settings page slug 'main-section', // Section ID array( 'option_name' => ASENHA_SLUG_U, 'field_id' => $field_id, 'field_slug' => $field_slug, 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']', 'field_description' => 'Enable log in, log out and dynamic log in/out menu item for addition to any menu.', 'field_options_wrapper' => true, 'field_options_moreless' => true, 'class' => 'asenha-toggle login-logout ' . $field_slug, ) ); // Enable Last Login Column $field_id = 'enable_last_login_column'; $field_slug = 'enable-last-login-column'; add_settings_field( $field_id, // Field ID 'Last Login Column', // Field title [ $render_field, 'render_checkbox_toggle' ], // Callback to render field with custom arguments in the array below ASENHA_SLUG, // Settings page slug 'main-section', // Section ID array( 'option_name' => ASENHA_SLUG_U, 'field_id' => $field_id, 'field_slug' => $field_slug, 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']', 'field_description' => 'Log when users on the site last logged in and display the date and time in the users list table.', 'field_options_wrapper' => true, 'field_options_moreless' => true, 'class' => 'asenha-toggle login-logout ' . $field_slug, ) ); // Redirect After Login $field_id = 'redirect_after_login'; $field_slug = 'redirect-after-login'; add_settings_field( $field_id, // Field ID 'Redirect After Login', // Field title [ $render_field, 'render_checkbox_toggle' ], // Callback to render field with custom arguments in the array below ASENHA_SLUG, // Settings page slug 'main-section', // Section ID array( 'option_name' => ASENHA_SLUG_U, 'field_id' => $field_id, 'field_slug' => $field_slug, 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']', 'field_description' => 'Set custom redirect URL for all or some user roles after login.', 'field_options_wrapper' => true, 'field_options_moreless' => true, 'class' => 'asenha-toggle login-logout ' . $field_slug, ) ); $field_id = 'redirect_after_login_to_slug'; $field_slug = 'redirect-after-login-to-slug'; add_settings_field( $field_id, // Field ID 'Redirect to:', // Field title [ $render_field, 'render_text_subfield' ], // Callback to render field with custom arguments in the array below ASENHA_SLUG, // Settings page slug 'main-section', // Section ID array( 'option_name' => ASENHA_SLUG_U, 'field_id' => $field_id, 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']', 'field_type' => 'with-prefix-suffix', 'field_prefix' => get_site_url() . '/', 'field_suffix' => ' for:', 'field_description' => '', 'class' => 'asenha-text with-prefix-suffix login-logout ' . $field_slug, ) ); $field_id = 'redirect_after_login_for'; $field_slug = 'redirect-after-login-for'; if ( is_array( $roles ) ) { foreach ( $roles as $role_slug => $role_label ) { // e.g. $role_slug is administrator, $role_label is Administrator add_settings_field( $field_id . '_' . $role_slug, // Field ID '', // Field title [ $render_field, 'render_checkbox_subfield' ], // Callback to render field with custom arguments in the array below ASENHA_SLUG, // Settings page slug 'main-section', // Section ID array( 'option_name' => ASENHA_SLUG_U, 'parent_field_id' => $field_id, 'field_id' => $role_slug, 'field_name' => ASENHA_SLUG_U . '[' . $field_id . '][' . $role_slug . ']', 'field_label' => $role_label, 'class' => 'asenha-checkbox asenha-hide-th asenha-half login-logout ' . $field_slug . ' ' . $role_slug, ) ); } } // Redirect After Logout $field_id = 'redirect_after_logout'; $field_slug = 'redirect-after-logout'; add_settings_field( $field_id, // Field ID 'Redirect After Logout', // Field title [ $render_field, 'render_checkbox_toggle' ], // Callback to render field with custom arguments in the array below ASENHA_SLUG, // Settings page slug 'main-section', // Section ID array( 'option_name' => ASENHA_SLUG_U, 'field_id' => $field_id, 'field_slug' => $field_slug, 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']', 'field_description' => 'Set custom redirect URL for all or some user roles after logout.', 'field_options_wrapper' => true, 'field_options_moreless' => true, 'class' => 'asenha-toggle login-logout ' . $field_slug, ) ); $field_id = 'redirect_after_logout_to_slug'; $field_slug = 'redirect-after-logout-to-slug'; add_settings_field( $field_id, // Field ID 'Redirect to:', // Field title [ $render_field, 'render_text_subfield' ], // Callback to render field with custom arguments in the array below ASENHA_SLUG, // Settings page slug 'main-section', // Section ID array( 'option_name' => ASENHA_SLUG_U, 'field_id' => $field_id, 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']', 'field_type' => 'with-prefix-suffix', 'field_prefix' => get_site_url() . '/', 'field_suffix' => ' for:', 'field_description' => '', 'class' => 'asenha-text with-prefix-suffix login-logout ' . $field_slug, ) ); $field_id = 'redirect_after_logout_for'; $field_slug = 'redirect-after-logout-for'; if ( is_array( $roles ) ) { foreach ( $roles as $role_slug => $role_label ) { // e.g. $role_slug is administrator, $role_label is Administrator add_settings_field( $field_id . '_' . $role_slug, // Field ID '', // Field title [ $render_field, 'render_checkbox_subfield' ], // Callback to render field with custom arguments in the array below ASENHA_SLUG, // Settings page slug 'main-section', // Section ID array( 'option_name' => ASENHA_SLUG_U, 'parent_field_id' => $field_id, 'field_id' => $role_slug, 'field_name' => ASENHA_SLUG_U . '[' . $field_id . '][' . $role_slug . ']', 'field_label' => $role_label, 'class' => 'asenha-checkbox asenha-hide-th asenha-half login-logout ' . $field_slug . ' ' . $role_slug, ) ); } } // ================================================================= // CUSTOM CODE // ================================================================= // Enable Custom Admin CSS $field_id = 'enable_custom_admin_css'; $field_slug = 'enable-custom-admin-css'; add_settings_field( $field_id, // Field ID 'Custom Admin CSS', // Field title [ $render_field, 'render_checkbox_toggle' ], // Callback to render field with custom arguments in the array below ASENHA_SLUG, // Settings page slug 'main-section', // Section ID array( 'option_name' => ASENHA_SLUG_U, 'field_id' => $field_id, 'field_slug' => $field_slug, 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']', 'field_description' => 'Add custom CSS on all admin pages for all user roles.', 'field_options_wrapper' => true, 'field_options_moreless' => true, 'class' => 'asenha-toggle custom-code ' . $field_slug, ) ); $field_id = 'custom_admin_css'; $field_slug = 'custom-admin-css'; add_settings_field( $field_id, // Field ID '', // Field title [ $render_field, 'render_textarea_subfield' ], // Callback to render field with custom arguments in the array below ASENHA_SLUG, // Settings page slug 'main-section', // Section ID array( 'option_name' => ASENHA_SLUG_U, 'field_id' => $field_id, 'field_slug' => $field_slug, 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']', 'field_type' => 'textarea', 'field_rows' => 30, 'field_intro' => '', 'field_description' => '', 'class' => 'asenha-textarea asenha-hide-th syntax-highlighted custom-code ' . $field_slug, ) ); // Enable Custom Frontend CSS $field_id = 'enable_custom_frontend_css'; $field_slug = 'enable-custom-frontend-css'; add_settings_field( $field_id, // Field ID 'Custom Frontend CSS', // Field title [ $render_field, 'render_checkbox_toggle' ], // Callback to render field with custom arguments in the array below ASENHA_SLUG, // Settings page slug 'main-section', // Section ID array( 'option_name' => ASENHA_SLUG_U, 'field_id' => $field_id, 'field_slug' => $field_slug, 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']', 'field_description' => 'Add custom CSS on all frontend pages for all user roles.', 'field_options_wrapper' => true, 'field_options_moreless' => true, 'class' => 'asenha-toggle custom-code ' . $field_slug, ) ); $field_id = 'custom_frontend_css'; $field_slug = 'custom-frontend-css'; add_settings_field( $field_id, // Field ID '', // Field title [ $render_field, 'render_textarea_subfield' ], // Callback to render field with custom arguments in the array below ASENHA_SLUG, // Settings page slug 'main-section', // Section ID array( 'option_name' => ASENHA_SLUG_U, 'field_id' => $field_id, 'field_slug' => $field_slug, 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']', 'field_type' => 'textarea', 'field_rows' => 30, 'field_intro' => '', 'field_description' => '', 'class' => 'asenha-textarea asenha-hide-th syntax-highlighted custom-code ' . $field_slug, ) ); // Custom Body Class $field_id = 'enable_custom_body_class'; $field_slug = 'enable-custom-body-class'; add_settings_field( $field_id, // Field ID 'Custom Body Class', // Field title [ $render_field, 'render_checkbox_toggle' ], // Callback to render field with custom arguments in the array below ASENHA_SLUG, // Settings page slug 'main-section', // Section ID array( 'option_name' => ASENHA_SLUG_U, 'field_id' => $field_id, 'field_slug' => $field_slug, 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']', 'field_description' => 'Add custom <body> class(es) on the singular view of some or all public post types. Compatible with classes already added using Custom Body Class plugin.', 'field_options_wrapper' => true, 'field_options_moreless' => true, 'class' => 'asenha-toggle custom-code ' . $field_slug, ) ); $field_id = 'enable_custom_body_class_for'; $field_slug = 'enable-custom-body-class-for'; if ( is_array( $asenha_public_post_types ) ) { foreach ( $asenha_public_post_types as $post_type_slug => $post_type_label ) { // e.g. $post_type_slug is post, $post_type_label is Posts if ( 'attachment' != $post_type_slug ) { add_settings_field( $field_id . '_' . $post_type_slug, // Field ID '', // Field title [ $render_field, 'render_checkbox_subfield' ], // Callback to render field with custom arguments in the array below ASENHA_SLUG, // Settings page slug 'main-section', // Section ID array( 'option_name' => ASENHA_SLUG_U, 'parent_field_id' => $field_id, 'field_id' => $post_type_slug, 'field_name' => ASENHA_SLUG_U . '[' . $field_id . '][' . $post_type_slug . ']', 'field_label' => $post_type_label . ' (' . $post_type_slug . ')', 'class' => 'asenha-checkbox asenha-hide-th asenha-half custom-code ' . $field_slug . ' ' . $post_type_slug, ) ); } } } // Manage ads.txt and app-ads.txt $field_id = 'manage_ads_appads_txt'; $field_slug = 'manage-ads-appads-txt'; add_settings_field( $field_id, // Field ID 'Manage ads.txt and app-ads.txt', // Field title [ $render_field, 'render_checkbox_toggle' ], // Callback to render field with custom arguments in the array below ASENHA_SLUG, // Settings page slug 'main-section', // Section ID array( 'option_name' => ASENHA_SLUG_U, 'field_id' => $field_id, 'field_slug' => $field_slug, 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']', 'field_description' => 'Easily edit and validate your ads.txt and app-ads.txt content.', 'field_options_wrapper' => true, 'field_options_moreless' => true, 'class' => 'asenha-toggle custom-code ' . $field_slug, ) ); $field_id = 'ads_txt_content'; $field_slug = 'ads-txt-content'; add_settings_field( $field_id, // Field ID '', // Field title [ $render_field, 'render_textarea_subfield' ], // Callback to render field with custom arguments in the array below ASENHA_SLUG, // Settings page slug 'main-section', // Section ID array( 'option_name' => ASENHA_SLUG_U, 'field_id' => $field_id, 'field_slug' => $field_slug, 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']', 'field_type' => 'textarea', 'field_rows' => 15, 'field_intro' => 'Your ads.txt content:', 'field_description' => 'Validate with: adstxt.guru | adstxtvalidator.com
', 'class' => 'asenha-textarea asenha-hide-th syntax-highlighted custom-code ' . $field_slug, ) ); $field_id = 'app_ads_txt_content'; $field_slug = 'app-ads-txt-content'; add_settings_field( $field_id, // Field ID '', // Field title [ $render_field, 'render_textarea_subfield' ], // Callback to render field with custom arguments in the array below ASENHA_SLUG, // Settings page slug 'main-section', // Section ID array( 'option_name' => ASENHA_SLUG_U, 'field_id' => $field_id, 'field_slug' => $field_slug, 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']', 'field_type' => 'textarea', 'field_rows' => 15, 'field_intro' => 'Your app-ads.txt content:', 'field_description' => 'Validate with: adstxt.guru', 'class' => 'asenha-textarea asenha-hide-th syntax-highlighted custom-code ' . $field_slug, ) ); // Manage robots.txt $field_id = 'manage_robots_txt'; $field_slug = 'manage-robots-txt'; add_settings_field( $field_id, // Field ID 'Manage robots.txt', // Field title [ $render_field, 'render_checkbox_toggle' ], // Callback to render field with custom arguments in the array below ASENHA_SLUG, // Settings page slug 'main-section', // Section ID array( 'option_name' => ASENHA_SLUG_U, 'field_id' => $field_id, 'field_slug' => $field_slug, 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']', 'field_description' => 'Easily edit and validate your robots.txt content.', 'field_options_wrapper' => true, 'field_options_moreless' => true, 'class' => 'asenha-toggle custom-code ' . $field_slug, ) ); $field_id = 'robots_txt_content'; $field_slug = 'robots-txt-content'; add_settings_field( $field_id, // Field ID '', // Field title [ $render_field, 'render_textarea_subfield' ], // Callback to render field with custom arguments in the array below ASENHA_SLUG, // Settings page slug 'main-section', // Section ID array( 'option_name' => ASENHA_SLUG_U, 'field_id' => $field_id, 'field_slug' => $field_slug, 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']', 'field_type' => 'textarea', 'field_rows' => 20, 'field_intro' => '', 'field_description' => 'Validate with: ryte.com | serp.tools
', 'class' => 'asenha-textarea asenha-hide-th syntax-highlighted custom-code ' . $field_slug, ) ); // Insert , and