Skip to:
Content
Pages
Categories
Search
Top
Bottom

Re: Different home pages for logged-in/logged-out users


Philip
Participant

@philipwalter

Depending on how comfortable you are with code, you can use conditional tags, if statements, and includes to do just about anything you want. I have several custom headers in my theme that load up depending on what kind of page is being displayed. You could have different template files (and thus, entirely different looking pages) load based on whether or not a user is logged in, and also what level of user is logged in.

For example, you could place the following in your header.php file:

<?php if (is_user_logged_in() && current_user_can('level_2') && !current_user_can('level_8')) {
include (TEMPLATEPATH . 'path to custom header file 1');
} elseif (is_user_logged_in() && current_user_can('level_8')) {
include (TEMPLATEPATH . 'path to custom header file 2');
} elseif (is_user_logged_in()) {
include (TEMPLATEPATH . 'path to custom header file 3');
} elseif (!is_user_logged_in()) {
include (TEMPLATEPATH . 'path to custom header file 4');
} ?>

This basically says, if the person looking at the site is a logged-in user AND they are an author AND they are not admin, load template file 1. If the person is logged in AND is admin, load template file 2. If the person is any other type of logged in user, load template file 3. If the person is not logged in, load template file 4.

I have been doing this sort of thing on my site with great results, but again, it does require a bit of tinkering with the template files and a certain comfort level with code.

Skip to toolbar