-
-
Save devuri/94e93503a9a3ada25e87ee2ac7133a85 to your computer and use it in GitHub Desktop.
Switch theme based on whether the user is logged in or not. One theme for guests, other theme for logged in users.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Plugin name: Different theme for guest than logged in user | |
*/ | |
// You can also put this file in mu-plugins dir. | |
add_filter( 'template', 'switch_theme__db' ); | |
add_filter( 'stylesheet', 'switch_theme__db' ); | |
function switch_theme__db( $template ) { | |
if ( ! is_admin() ) { | |
if ( is_user_logged_in() ) { | |
return 'twentythirteen'; | |
} else { | |
return $template; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment