This question already has an answer here:
- Add class based on published state 3 answers
I would like to be able to add an unpublished class to the body tag of a node (for both its main view and edit view) if the node has been unpublished.
How can I do this?
Steps I have taken:
1) Node Object
The node object contains if a node has been published or unpublished (with
$node -> Status), but I am not sure how to test this for each node and then add it to the body class.
This question is similar, but the provided answer doesn't work.
2) Drupal 6 This page explains how to do it for Drupal 6, but the code doesn't work for Drupal 7.