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

I have the following code:

 if ((is_home()) OR (!is_single()) OR (!is_page('171'))) : ?>
<?php else: ?>
    <body class="last-page">
<?php endif; ?>

However it doesn't seem to work as expected. I want the class "last-page" to be applied to the body of the page with the id of 171 and pages that display single posts. If I take the third condition out, the "last-page" class is applied correctly to single post pages but with the third condition there it doesn't get applied to any of the two.

I want the "last-page" class to be applied to both single post pages and page 171.

Appreciate the help.

share|improve this question
Consider using the body_class filter for this: related example. – Geert May 6 '11 at 12:55
up vote 0 down vote accepted

from your verbal desription, i would think this should work:

<?php  if ( is_single() OR is_page('171') ) : ?>
<body class="last-page"> 
<?php else: ?>     
<?php endif; ?>
share|improve this answer
Thanks @Michael, thats done the trick. – Sid May 6 '11 at 11:33

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.