WordPress: Only show something on non-homepage

<?php if (! is_front_page()) {?>
<!-- HTML here! -->
<?php } ?>

This piece of code can be used in your WordPress templates in order to show a piece of text or code on all pages expect for the homepage. If you want to make a button that points back to the homepage, for example, than you can use this code as it makes no sense to place such button on the homepage since it would point to itself.

 

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.

 

Leave a Reply

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