WordPress having an option called Preview, while writing a post if we want to check the structure or alignment we can use preview option. Preview option is placed in Right Side of Edit Post Page. Here is the PHP code to display a message that you are in preview page.
is_preview()
is_preview() function will return the boolean value of true or false. If the page is preview, then it will return true else it will return false.
Include the below coding in header.php file just after the <body> tag
[code type=php]
<?php
if(is_preview())
{
echo “<div class=’preview-box’>This Page is Preview Page</div>”;
}
?>
[/code]
Include the below coding in style.css file
[code type=css]
.preview-box
{
position: fixed;
bottom: 0px;
background: #E54324;
color: #fff;
width: 100%;
padding: 12px 0px;
font-weight: bold;
}
[/code]
After including this file in header.php and style.css file then alert message will be shown in bottom.