Code to hide content on the front page of WordPress

Another day, another little WordPress tutorial for you guys.

This time, I’m posting a how to for those of you who have rolled back the old sleeves, and are actually digging into some PHP to make or edit your WordPress template.

Now it should go without saying that if you are making modifications to your theme’s template files, you should be doing this using a Child Theme, or entirely custom theme project, otherwise your customizations will be obliterated if and when you hit “update” on your theme! And you must update. You really must. Also, you must backup. Backup and update. That is the WordPress way! Well… its something to remember.

So, you came here looking for a tutorial on how to hide some code or other only from your front page. And here’s how (hint, I used this to hide breadcrumbs on home… because, well, you don’t need a breadcrumb on home).

Code to hide content on the front page of WordPress



Note we leave PHP in the above code, so that you can (if necessary) place whatever you like in there, including HTML, or other PHP code. If you are entering PHP in your code, respectfully, I suggest you edit this and do it in one hit, for a mild performance boost.

For example:

Hide Yoast Breadcrumbs on the homepage in your WordPress template files



Leave a comment to cheer – or boo – this Tutorial!

If you got what you needed here, then please leave a comment. Also complain if I said something you think is wrong or foolish. I will edit my post, quietly, and the world will be all the wiser. At least, the four people and one bot which swoops by here might.

Leave a comment

No links of any kind allowed in comments - if you add any links, your comment will automatically be deleted.