For certain reasons I do not want the home page of my site to be a wordpress driven page, but I would like to check if the user is logged in to display the login/logout link properly.
In the index.php file in my root directory, I first do this without getting any errors (cae is the directory of my blog):
<?php
require("cae/wp-load.php");
?>
Then I tested the following sample code found in the WP function reference:
<?php if (is_user_logged_in()){
echo "Welcome, registered user!";
}
else {
echo "Welcome, visitor!";
};
?>
The result is that I get "Welcome, visitor!" every time regardless of whether the user is logged in.
Any ideas on how this can be done successfully with a non-wordpress page? Is there a different php file I need to include?
Thanks!