How to check if user is logged-in on non-wp pages?
-
I have wordpress installed on my site and I want to be able to use the logins from the wordpress to control the display of other things on the site (outside of the blog)
I want users who are logged in to see a different menu and stuff like that.
Is there a good way to do this? Check to see if users are logged in?
currently, I’m including a bunch of wp files in every page to get this info. I’m afraid this is causing my processor problems.
if($page_section != "news"){ $blog_location = $_SERVER['DOCUMENT_ROOT'] . "/news"; if (! isset($wp_did_header)): if ( !file_exists( $blog_location . '/wp-config.php') ) { if (strpos($_SERVER['PHP_SELF'], 'wp-admin') !== false) $path = ''; else $path = 'wp-admin/'; require_once( $blog_location . '/wp-includes/classes.php'); require_once( $blog_location . '/wp-includes/functions.php'); require_once( $blog_location . '/wp-includes/plugin.php'); wp_die("error message", "WordPress › Error"); } $wp_did_header = true; require_once( $blog_location . '/wp-config.php'); wp(); endif; }
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘How to check if user is logged-in on non-wp pages?’ is closed to new replies.