7

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?

1 Answer 1

6

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:

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

Hope this helps, best of luck!

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.