WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Just to warn you, I am a complete PHP novice!

I have one sidebar for all pages, however I would like to display certain elements on this sidebar for certain pages.

I know there are a few widget plugins, however I am not using widgets, I am just coding in the sidebar.php file.

I am aware I can do this...

<?php if( is_page('37') ):?>
<?php endif;?>

... for showing the content if on that page, but what is the opposite of this? So that 'SHOW STUFF' does not show if we are on page 37?

Thanks in advance

share|improve this question
up vote 1 down vote accepted

So, you can use:

<?php if( !is_page('37') ):?>
<?php endif;?>

P.S. ! (not parameter)

Good tutorial - http://sixrevisions.com/web-development/php-conditional-statements/

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.