Ashburn, June 27, 2017

WordPress Different Theme for Logged in Users

Wordpress different theme logged users
Wordpress different theme logged users

I will show you here how to set up a wordpress different theme for logged in users.

When running a WordPress membership site, a forum in WordPress, or allowing users to submit posts, you may come across situations where you want to show wordpress different theme for logged in users and logged out users. For example, you may want to show logged in users a more simplistic theme. In this article, we will show you how to show wordpress different theme for logged in users.

WordPress Different Theme for Logged in Users

All you need is to add this code in your theme’s functions.php file or a site-specific plugin:

require_once (ABSPATH . WPINC . '/pluggable.php');
add_filter( 'template', 'kmb_user_theme_template' );
add_filter( 'stylesheet', 'kmb_user_theme_template' );
function kmb_user_theme_template( $template ) {

    if ( is_user_logged_in() ) :
        $template = 'my_awesome_theme'; 
    endif;

    return $template;
}

You will need to replace ‘my_awesome_theme’ by the name of your theme, which is usually the name of the directory.

It works like a charm.

Should you have any questions feel free to send me a message here.

Cheers!

About Karlos Maldonado 36 Articles
Computer Sciences Engineer graduated from Florida Atlantic University (FAU) in Boca Raton, Florida. Has gotten great experience in the IT and Web Development industry working for companies such as SIRIUS XM RADIO, 4MEDIA as well as collaborating with local companies.

Be the first to comment

Leave a Reply

Your email address will not be published.