Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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') ):?>
SHOW STUFF
<?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

1 Answer 1

up vote 1 down vote accepted

So, you can use:

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

P.S. ! (not parameter)

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

share|improve this answer

Your Answer

 
discard

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.