Skip to content
Wordpress Expert

Wordpress Expert

Wordpress Expert | Praveen Shekhawat

Tag: User

Posted on December 19, 2012January 11, 2014

Hide your page if user is not logged in

If you want to hide any page if user is not logged in. To do this you can use this simple example.

<?php
/* Template Name: Only for logged in users */
if ( !is_user_logged_in()) {
get_template_part('not-logged-in');
exit(0);
}
get_header();
?>

the file that’s called might be something like this:

<!DOCTYPE HTML>
<html>
<head>
<title>Oooops...! You need to login.</title>
</head>
<body>
<h1>To view this page you need to login.</h1>
</body>
</html>
Email

Tags

  • api
  • Archive
  • Create a Custom Post Type
  • CSS
  • CSS3
  • CSS3 Generator
  • Custom meta Box
  • Custom post type
  • Custom Post Types
  • Disable Post Revisions
  • drop down menus
  • Email
  • get popular posts
  • Google
  • Google analytics
  • Gradient Generator
  • Htaccess
  • HTML
  • IE
  • image
  • image size
  • Login
  • Opacity Generator
  • page
  • Payment API
  • PHP
  • popular posts
  • Portfolio
  • Post
  • Post meta
  • Reduce Database Size
  • Related post
  • security
  • show popular posts
  • the_post()
  • thumbnail
  • User
  • Wordpress
  • Wordpress Admin
  • Wordpress google analytics
  • wordpress plugin
  • Wordpress post
  • wordpress shortcode
  • WP_Query
  • youtube

Categories

  • CSS
  • Design
  • Development
  • HTML
  • HTML5
  • PHP
  • Uncategorized
  • Woedpress Theme
  • Wordpress
  • wordpress Admin
  • Wordpress plugin
Proudly powered by WordPress