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.

I have the following code:

<?php
 if ((is_home()) OR (!is_single()) OR (!is_page('171'))) : ?>
    <body>
<?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
add comment

1 Answer

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: ?>     
<body>
<?php endif; ?>
share|improve this answer
    
Thanks @Michael, thats done the trick. –  Sid May 6 '11 at 11:33
add comment

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.