0

I integrated dark mode switcher into my theme. It's logic of work is as follows:

I made a button with jquery, it toggles dark_mode cookie value 1 or 0

In my php:

if ( isset( $_COOKIE[ 'dark_mode' ] ) && $_COOKIE[ 'dark_mode' ] === '1' ) {
    //enqueue dark-mode.css
} else {
    //enqueue normal.css
}

But this not working with any cache plugins. Can you suggest me a better way?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.