Show Different Front Page Template For Logged In Users

This tutorial includes all the code which displays a different template on the front page for logged in users only.

Logged out visitors will see the default template.

One of the reasons you might want to use this solution is if you have a landing page and don’t want to show that page for members who have already joined.

There’s 2 files you need to deal with:

  1. One is the new template you need to create which is named members_home.php
  2. And the other is the code for your child themes functions file.

Logged In Template

Simply create a new file using a code editor like Notepad++ and add your code to the file like this:

Other Options

You could code functionality for both templates into the same file and use the is_user_logged_in() conditional tag to execute specific functions for logged in and out users but i think using 2 templates is a cleaner solution.

What do you think?

Join 5000+ Followers

Get The Latest Free & Premium Tutorials Delivered The Second They’re Published.