Created
August 7, 2014 16:49
-
-
Save dbernar1/6cff3f251f6c5985fd86 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