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

Is there a way to have a custom template php file that is only used for previews instead of it using the single.php file? This way the user knows they are in preview mode?

share|improve this question
up vote 6 down vote accepted

You could use the conditional is_preview() to add a bit of extra content.

For instance, you could put this at the very top of your single.php right after the header is called - or you could put it in your header.php file if you want it shown at the very top of the page:

if ( is_preview() ) { ?>
     <div>You're viewing a preview</div>
<?php } ?>

Hope this helps, best of luck!

share|improve this answer
Thanks! Can't believe I didn't think of that. – JonnyPlow Jun 11 '12 at 20:35

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.