PHP user logged in and certain page

I am using this in my wordpress theme in my header.php to display a block of html that I want to show to users that are not logged in.

<?php
if ( ! is_user_logged_in() && ! ( is_page( '/register' ) || is_page( '/login' ) ) ) {
echo '';
} else {
echo '<div class="container" style="text-align:center;">
       <div class="well" style="width:1040px;margin:0    auto;background:#fbfbfb;margin-bottom:10px;">
  <h3>Welcome, visitor!</h3>
  <p style="color:#999;">Welcome to autospot.it the automotive social network! <a href="http://autospot.it/about">Learn more...</p>
  <p><a href="http://www.autospot.it/register/" class="btn btn-primary btn-large">Register</a> - or - <a href="http://www.autospot.it/login/" class="btn btn-danger btn-large">Login</a> 
  </div>
      </div>';
} 
?>

This works fine but I would also like for it not to be shown on the login page and the register page.

Answers


Use is_page to detect your front-end login and registration pages:

<?php
    if ( ! is_user_logged_in() && ! ( is_page( 'register' ) || is_page( 'login' ) ) ) {
        echo '<div>Some stuff here</div>'; // your code
    }
?>

Need Your Help

c# Placeholder from input in web browser

c# winforms browser placeholder

A little strange but it seems like there is nothing for "Placeholders" in the web browser in winforms c#.

Implementing WS-Security in Progress ABL

soap ws-security progress-4gl openedge

I'm struggling with implementing WS-Security in Progress ABL.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.