Convert checkboxes to ACF-style toggle switches: - Add sliding toggle switch UI - Implement smooth transitions - Add hover and focus states - Improve accessibility - Update HTML structure for toggle switches

This commit is contained in:
Marcus Quinn
2025-03-14 02:35:26 +00:00
parent d379ab25e4
commit bef76a5727
2 changed files with 90 additions and 49 deletions

View File

@ -56,12 +56,15 @@ function wpa_superstar_settings_page() {
<?php if ( $active_tab == 'general' ) : ?>
<div class="wpa-superstar-toggle">
<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 ) ); ?>
/>
<div class="wpa-toggle-switch">
<input type="checkbox"
id="wpa_superstar_lazy_load"
name="wpa_superstar_lazy_load"
value="1"
<?php checked( get_option( 'wpa_superstar_lazy_load', 1 ) ); ?>
/>
<span class="wpa-toggle-slider"></span>
</div>
<?php esc_html_e( 'Enable lazy loading for images', 'wpa-superstar' ); ?>
</label>
<p class="description">
@ -71,12 +74,15 @@ function wpa_superstar_settings_page() {
<?php elseif ( $active_tab == 'advanced' ) : ?>
<div class="wpa-superstar-toggle">
<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 ) ); ?>
/>
<div class="wpa-toggle-switch">
<input type="checkbox"
id="wpa_superstar_minify_css"
name="wpa_superstar_minify_css"
value="1"
<?php checked( get_option( 'wpa_superstar_minify_css', 0 ) ); ?>
/>
<span class="wpa-toggle-slider"></span>
</div>
<?php esc_html_e( 'Enable CSS minification', 'wpa-superstar' ); ?>
</label>
<p class="description">
@ -86,12 +92,15 @@ function wpa_superstar_settings_page() {
<div class="wpa-superstar-toggle">
<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 ) ); ?>
/>
<div class="wpa-toggle-switch">
<input type="checkbox"
id="wpa_superstar_minify_js"
name="wpa_superstar_minify_js"
value="1"
<?php checked( get_option( 'wpa_superstar_minify_js', 0 ) ); ?>
/>
<span class="wpa-toggle-slider"></span>
</div>
<?php esc_html_e( 'Enable JS minification', 'wpa-superstar' ); ?>
</label>
<p class="description">