WordPress: If homepage or index.php

Wordpress CodingTo display content in WordPress only on the homepage (example.com) or on the index page (index.php), use the following code snippet:

<?php if ( is_front_page() ) : ?>
<p>The content that is only shown on the homepage of your WordPress installation, or on the index.php page, but not on any other page or blogpost.</p>
<?php endif ?>

 

Author Bio

Thank you for your interest in my blog! On this miniblog, I write mostly short (technical) blog posts that might interest other people. Read more about me or feel free to contact me.

 

2 thoughts on “WordPress: If homepage or index.php

Leave a Reply

Your email address will not be published. Required fields are marked *