Update admin UI to match ACF plugin style: - Improve checkbox styling and layout - Add descriptive text for options - Enhance accessibility with proper labels and IDs - Implement WordPress admin color scheme

This commit is contained in:
Marcus Quinn
2025-03-14 02:28:11 +00:00
parent 1098b3cd14
commit d379ab25e4
2 changed files with 118 additions and 24 deletions

@ -37,37 +37,70 @@ add_action( 'wp_ajax_wpa_superstar_update_option', 'wpa_superstar_update_option'
function wpa_superstar_settings_page() {
$active_tab = isset( $_GET['tab'] ) ? $_GET['tab'] : 'general';
?>
<div class="wpa-superstar-wrap">
<div class="wrap wpa-superstar-wrap">
<h1><?php echo esc_html( get_admin_page_title() ); ?></h1>
<h2 class="nav-tab-wrapper">
<a href="?page=wpa-superstar&tab=general" class="nav-tab <?php echo $active_tab == 'general' ? 'nav-tab-active' : ''; ?>">General</a>
<a href="?page=wpa-superstar&tab=advanced" class="nav-tab <?php echo $active_tab == 'advanced' ? 'nav-tab-active' : ''; ?>">Advanced</a>
<a href="?page=wpa-superstar&tab=general" class="nav-tab <?php echo $active_tab == 'general' ? 'nav-tab-active' : ''; ?>">
<?php esc_html_e( 'General', 'wpa-superstar' ); ?>
</a>
<a href="?page=wpa-superstar&tab=advanced" class="nav-tab <?php echo $active_tab == 'advanced' ? 'nav-tab-active' : ''; ?>">
<?php esc_html_e( 'Advanced', 'wpa-superstar' ); ?>
</a>
</h2>
<form method="post" action="options.php">
<?php settings_fields( 'wpa-superstar-settings' ); ?>
<?php do_settings_sections( 'wpa-superstar-settings' ); ?>
<?php if ( $active_tab == 'general' ) : ?>
<div class="wpa-superstar-toggle">
<label>
<input type="checkbox" name="wpa_superstar_lazy_load" value="1" <?php checked( get_option( 'wpa_superstar_lazy_load', 1 ) ); ?> />
Enable lazy loading for images
<label for="wpa_superstar_lazy_load">
<input type="checkbox"
id="wpa_superstar_lazy_load"
name="wpa_superstar_lazy_load"
value="1"
<?php checked( get_option( 'wpa_superstar_lazy_load', 1 ) ); ?>
/>
<?php esc_html_e( 'Enable lazy loading for images', 'wpa-superstar' ); ?>
</label>
<p class="description">
<?php esc_html_e( 'Improves page load time by loading images only when they enter the viewport.', 'wpa-superstar' ); ?>
</p>
</div>
<?php elseif ( $active_tab == 'advanced' ) : ?>
<div class="wpa-superstar-toggle">
<label>
<input type="checkbox" name="wpa_superstar_minify_css" value="1" <?php checked( get_option( 'wpa_superstar_minify_css', 0 ) ); ?> />
Enable CSS minification
<label for="wpa_superstar_minify_css">
<input type="checkbox"
id="wpa_superstar_minify_css"
name="wpa_superstar_minify_css"
value="1"
<?php checked( get_option( 'wpa_superstar_minify_css', 0 ) ); ?>
/>
<?php esc_html_e( 'Enable CSS minification', 'wpa-superstar' ); ?>
</label>
<p class="description">
<?php esc_html_e( 'Minifies CSS files to reduce file size and improve load times.', 'wpa-superstar' ); ?>
</p>
</div>
<div class="wpa-superstar-toggle">
<label>
<input type="checkbox" name="wpa_superstar_minify_js" value="1" <?php checked( get_option( 'wpa_superstar_minify_js', 0 ) ); ?> />
Enable JS minification
<label for="wpa_superstar_minify_js">
<input type="checkbox"
id="wpa_superstar_minify_js"
name="wpa_superstar_minify_js"
value="1"
<?php checked( get_option( 'wpa_superstar_minify_js', 0 ) ); ?>
/>
<?php esc_html_e( 'Enable JS minification', 'wpa-superstar' ); ?>
</label>
<p class="description">
<?php esc_html_e( 'Minifies JavaScript files to reduce file size and improve load times.', 'wpa-superstar' ); ?>
</p>
</div>
<?php endif; ?>
<?php submit_button(); ?>
<?php submit_button( __( 'Save Changes', 'wpa-superstar' ) ); ?>
</form>
</div>
<?php