| @@ -23,8 +23,19 @@ | ||
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | public function darkify_shortcode_parser($atts, $content = null) |
| 26 | 26 | { |
| 27 | + // With Frontend Dark Mode off, client_main.css/.js are never | |
| 28 | + // enqueued on the front end, so rendering the switch markup anyway | |
| 29 | + // leaves an unstyled toggle behind that does nothing when clicked. | |
| 30 | + // Gate every switch entry point here: the Gutenberg block and the | |
| 31 | + // Elementor widget both render through this shortcode. The floating | |
| 32 | + // switch, menu switch and inline scripts are already gated in | |
| 33 | + // Frontend.php. | |
| 34 | + if (! $this->base_client->darkify_is_dark_mode_allowed()) { | |
| 35 | + return ''; | |
| 36 | + } | |
| 37 | + | |
| 27 | 38 | $options = get_option('darkify'); |
| 28 | 39 | |
| 29 | 40 | // Background |
| 30 | 41 | $switch_background = isset($options['switch_background']) ? $options['switch_background'] : []; |