card_open_svg(), toggle_row(), etc. * * @package Admbud */ if ( ! defined( 'ABSPATH' ) ) { exit; } // phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- Variables scoped to this included template file. /** @var \Admbud\Settings $settings */ $footer_enabled = admbud_get_option( 'admbud_core_custom_footer_enabled', '0' ) === '1'; $footer_text = admbud_get_option( 'admbud_core_custom_footer_text', '' ); $suppress = admbud_get_option( 'admbud_notices_suppress', '1' ) === '1'; $pages = get_pages( [ 'post_status' => [ 'publish', 'draft', 'private', 'pending' ], 'sort_column' => 'post_title' ] ); $role_pages = Admbud\Dashboard::get_role_pages(); $default_page = isset( $role_pages['_default'] ) ? $role_pages['_default'] : 0; $has_role_overrides = ! empty( $role_pages['_per_role'] ); $subtabs = [ 'adminui-branding' => __( 'Branding', 'admin-buddy' ), 'adminui-dashboard' => __( 'Dashboard', 'admin-buddy' ), ]; // Read-only navigation state: which subtab to render. sanitize_key()'d // and constrained to known whitelist via array_key_exists() below. $active = sanitize_key( wp_unslash( $_GET['admbud_subtab'] ?? 'adminui-branding' ) ); // phpcs:ignore WordPress.Security.NonceVerification $active = array_key_exists( $active, $subtabs ) ? $active : 'adminui-branding'; ?>
$label ) : ?>
card_open_svg( '', __( 'Site Identity', 'admin-buddy' ), __( 'Global branding elements that appear across WordPress.', 'admin-buddy' ) ); ?> image_upload_row( 'admbud_wl_sidebar_logo_url', __( 'Sidebar Logo', 'admin-buddy' ), __( 'Displayed at the top of the WordPress admin sidebar. Scales to the sidebar width automatically.', 'admin-buddy' ), true, 'admbud_wl_sidebar_logo_width', 'admbud_wl_sidebar_logo_height', 40, 320, 120 ); ?> card_close(); ?> card_open_svg( '', __( 'Admin Bar', 'admin-buddy' ), __( 'Control what appears in the top admin toolbar and replace WordPress branding.', 'admin-buddy' ) ); ?> text_field_row( 'admbud_wl_agency_name', __( 'Agency Name', 'admin-buddy' ), __( 'Replaces "WordPress" in browser tab titles (e.g. "Dashboard ‹ Your Agency") and shows "Powered by Your Agency" in the admin footer when no custom footer text is set.', 'admin-buddy' ), __( 'e.g. Starter Digital', 'admin-buddy' ) ); $settings->url_field_row( 'admbud_wl_agency_url', __( 'Agency URL', 'admin-buddy' ), __( 'The WP logo in the admin bar links to this URL. Also used in the "Powered by" footer link when Agency Name is set.', 'admin-buddy' ) ); $settings->text_field_row( 'admbud_wl_greeting', __( 'Custom Greeting', 'admin-buddy' ), __( 'Replace "Howdy, username" with your own text. Use {username} as a placeholder for the display name.', 'admin-buddy' ), __( 'e.g. Welcome', 'admin-buddy' ) ); ?>
[ 'label' => __( 'Remove WordPress Logo', 'admin-buddy' ), 'desc' => __( 'Hides the WP logo from the admin toolbar.', 'admin-buddy' ), 'default' => '1' ], 'admbud_wl_remove_wp_links' => [ 'label' => __( 'Remove WordPress.org Links', 'admin-buddy' ), 'desc' => __( 'Hides "About WordPress", "Documentation", "Support Forums" and "Feedback" from the admin bar dropdown.', 'admin-buddy' ), 'default' => '0' ], 'admbud_show_in_adminbar' => [ 'label' => __( 'Show Admin Buddy in Admin Bar','admin-buddy' ), 'desc' => __( 'Adds a quick-access link to Admin Buddy in the top toolbar.', 'admin-buddy' ), 'default' => '0' ], 'admbud_core_remove_help' => [ 'label' => __( 'Hide Help Tab', 'admin-buddy' ), 'desc' => __( 'Hides the Help dropdown tab from all admin pages.', 'admin-buddy' ), 'default' => '0' ], 'admbud_core_remove_screen_options' => [ 'label' => __( 'Hide Screen Options', 'admin-buddy' ), 'desc' => __( 'Hides the Screen Options dropdown tab from admin pages.', 'admin-buddy' ), 'default' => '0' ], ]; foreach ( $admbud_bar_toggles as $key => $item ) : $checked = admbud_get_option( $key, $item['default'] ) === '1'; ?>
card_close(); ?> card_open_svg( '', __( 'Footer', 'admin-buddy' ), __( 'Customise the admin page footer area.', 'admin-buddy' ) ); ?> toggle_row( 'admbud_wl_footer_quote', __( 'Show Motivational Quote', 'admin-buddy' ), __( 'Displays a random motivational quote on the right side of the admin footer, before the version text.', 'admin-buddy' ), '0' ); ?> card_close(); ?>
` inside `//` * comments here — PHP's single-line comment is terminated * by a literal `?` followed by `>` even *inside* the * comment text, which would close the surrounding PHP * block and prevent the assignment below from running. * Use block comments for any prose that mentions PHP * delimiters. */ $admbud_page_dropdown_lis = function( $pages, $selected ) { foreach ( $pages as $p ) { $label = $p->post_title ?: __( '(no title)', 'admin-buddy' ); if ( $p->post_status !== 'publish' ) { $label .= ' [' . ucfirst( $p->post_status ) . ']'; } $is_selected = ( (string) $p->ID === (string) $selected ); printf( '
  • %s
  • ', $is_selected ? ' is-selected' : '', esc_attr( $p->ID ), $is_selected ? ' aria-selected="true"' : '', esc_html( $label ) ); } }; // Resolve the current default-page label so the trigger // text reflects what's stored. `0` is "WP dashboard"; any // other value matches a page ID. $admbud_default_page_label = __( '- WordPress Dashboard -', 'admin-buddy' ); if ( (int) $default_page > 0 ) { foreach ( $pages as $p ) { if ( (int) $p->ID === (int) $default_page ) { $admbud_default_page_label = $p->post_title ?: __( '(no title)', 'admin-buddy' ); break; } } } ?> card_open_svg( '', __( 'Dashboard Page', 'admin-buddy' ), __( 'Show a custom page instead of the standard WordPress dashboard.', 'admin-buddy' ) ); ?>
    roles; foreach ( $wp_roles as $role_slug => $role_data ) : $role_page = $role_pages[ $role_slug ] ?? ''; ?> 0 ) { foreach ( $pages as $p ) { if ( (int) $p->ID === (int) $role_page ) { $admbud_role_trigger_label = $p->post_title ?: __( '(no title)', 'admin-buddy' ); break; } } } ?>
    card_close(); ?> $v ) { if ( $k === '_per_role' || $k === '_default' ) { continue; } if ( is_int( $v ) && $v > 0 ) { $any_page_set = true; break; } } } if ( ! $any_page_set ) : // -- Card: Dashboard Widgets -------------------------------- ?> card_open_svg( '', __( 'Dashboard Widgets', 'admin-buddy' ), __( 'Choose which dashboard widgets to show. Toggle off to hide.', 'admin-buddy' ) ); ?>
    ' . esc_html__( 'WordPress Dashboard', 'admin-buddy' ) . '' ); ?>
    $wtitle ) : // If never configured, all are checked (visible). If configured, only kept ones are checked. $checked = $is_configured ? in_array( $wid, $keep_ids, true ) : true; ?>
    card_close(); ?> card_open_svg( '', __( 'Custom Widgets', 'admin-buddy' ), __( 'Add your own dashboard widgets. Supports HTML and shortcodes.', 'admin-buddy' ) ); ?>
    $cw ) : ?>
    card_close(); ?>