treehouse : what would you like to learn today?
Web Design Web Development iOS Development

Wordpress Login Page

  • I tried the solution on this http://www.kriesi.at/archives/admin-login-on-your-front-page for a site I am working on. Here is a scenario :
    [list]
    [*] I want to have a login page for my site which is based on wordpress. Users are not suppose to see anything on the site unless they are logged on. So,[/*:m]
    [*]I put all the code inside my header file and inside the IF condition I have put the form just like in your demo. All users must be logged on to see the site. See snippet below...[/*:m]
    [*]My ELSE part will be my entire page. The contents of the header file - menus and the whatnot, everything inside the wrapper and footer. I close the ELSE brace at the end of the footer[/*:m][/list:u].
    Problem: I am getting an error when I close the brace for the ELSE part of the IF statement.

    Here is a small snippet:

    if (condition){
    ///form goes here
    }else {
    //rest of the header file
    //wrapper opens here and closes at the end of the index file
    } // this is done at the end of the footer. But i get an error.


    What am I missing?
  • What is the error that you are getting? The code snippet itself looks ok.
  • Hi,

    Thanks for your response.

    I get the error when closing the brace for the ELSE part of the IF statement:

    [Fri Aug 07 13:56:50 2009] [error] [client 127.0.0.1] PHP Parse error: parse error in C:\\Program Files\\Apache Software Foundation\\Apache2.2\\htdocs\\...\\header.php on line 77, referer: http://localhost/test/.

    I tried the following:
    I closed the ELSE statement at the start of footer.php - the error then I tried at the end of the index file just before <?php get_footer();?>. And I get the error again.

    Now, just so that I can test what I am doing I closed the brace just before the wrapper <div> - this is inside the header file.

    just out of curiosity - am not a php or wordpress guru - is it possible to close code block - {//code block} in a different file?
  • Yes, it is possible to close the code block in a different file. Are you sure you don't have an extra closing } in one of your files? That may cause the error, which means that what you think is the closing } on the if statement is actually unnecessary.
  • I guess that is my project for the weekend.... Going through the function calls in wordpress...


    Thanks gain.