Example 1 — Show a welcome box
Print a message only on the front page.
<?php if ( is_front_page() ) : ?>
<div class="welcome">Welcome to our website!</div>
<?php endif; ?> How It Works
is_front_page()is true on the main page of the site.- The
divis printed only there. - It works for both a static page and latest posts.

