Discover in this tutorial how to hide the title on Storefront theme pages or posts in using code.
Storefront is one of the most suitable themes to use in conjunction with WooCommerce as it has been created by the same company and the integration of the theme with the plugin is very good.
If you are using it and you want the home page (or other) not to display the title, because, for example, you prefer to add it with the block editor, here’s how to do it.
Snippet to remove the title in the Storefront theme
Add the following snippet to the end of the functions.php file:
To see this and another 1097 code snippets of this website, login or subscribe here.
In this snippet you remove the function storefront_page_header
from the main page using the conditional tag is_front_page
. You can achieve the same for individual pages using the conditional tag is_page
.
If on the other hand you prefer not to have the title displayed when using a specific page template, this would be the snippet you need:
To see this and another 1097 code snippets of this website, login or subscribe here.
In this case you use the same function to remove the title but the conditional tag is is_template_page
.
In this example you use an array where you add two templates where you do not want the title to be displayed:
- template-fullwidth-no-title.php
- template-fullwidth-narrow-no-title.php
Just change it to the name of your page template and indicate the path where it is located. In the example it is page-templates/
, but you can adjust it if you have modified the theme structure.
Conclusion
As you can see, with a few lines of code you can hide the title of pages or posts in the Storefront theme.
Any questions? I read you in the comments.
And if you want to give me any suggestion for future tutorials, leave it in the contact form. Advantages of being a subscriber. 😉