After logout browser’s back button into twenty sixteen theme profile

You should use the built in WordPress function is_user_logged_in(), as well as several other WordPress functions: if ( !is_user_logged_in() ) { wp_redirect( get_bloginfo( ‘url’ ) . ‘/index.php’ ); exit; } wp_redirect() handles the redirection for you. Please be aware that it does not exit automatically, so you should call it afterwards. I also built in … Read more

Setting Cookies

Solution with cookie [wordpress] You will need jQuery cookie plugin. Create javascript file “themechanger.js”: (function($){ var theme = $.cookie(“styles”); var themehref = document.getElementById(theme_styles.rel_id); setTheme = function(mode){ if (theme == mode) return; if (mode == ‘light’) { $.cookie(‘styles’, mode); themehref.href = theme_styles.light; } else if (mode == ‘dark’) { $.cookie(‘styles’, mode); themehref.href = theme_styles.dark; } } … Read more