Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

WordPress

How to seperate page display from a logged in user and visitor?

I am using this code see below. However when I use many divs and other html tags it cant display the entire page. It will go blank.

I want to seperate the display with many divs and coding. Goal is to show to page if you are logged in and hide it by displaying a message "Please log in to view this page". However, that does not work. A normal text like below does.

I hope someone can help out.

============================================ <?php if ( is_user_logged_in() ) { echo 'Welcome, registered user!'; } else { echo 'Welcome, visitor!'; }

?>