If, for any reason, you want to hide the titles of your posts or pages, read on, it’s pretty easy!
How to Hide Titles in Single Posts
Here’s a simple way of hiding a single post. If you don’t want to mess with custom css, you can use a plugin instead (it’s always the easy way to solve WordPress problems for free). Just follow these steps:
- Search, install, and activate Hide Title plugin (or a similar plugin).
- Open the post or page that you want to hide.
- At the right side of your screen, you will find the Hide Title meta box.
- Check the box that says “hide title on singular page views.
- Click the update or publish button (if it’s a new post).
Note 1: With the above technique, titles will still be in your site’s archive pages as well as your homepage. It’s only on single page views that the titles will be hidden.
Note 2: This technique is applicable to landing pages as you don’t want to show the post title in such cases.[/vc_column_text][templatera id=”15800″][vc_column_text el_class=”hostpg1″]
How to Hide Titles in all Pages or Posts
Here are the steps to hiding titles on your WordPress pages and posts:
- Find your site’s theme template.
- Edit your WordPress theme by adding this PHP code to the functions.php file:
function wpb_hidetitle_class($classes) {
if ( is_single() || is_page() ) :
$classes[] = 'hidetitle';
return $classes;
endif;
return $classes;
}
add_filter('post_class', 'wpb_hidetitle_class');
Note 1: The above code will only work if your theme supports the post class function.
Note 2: If you only want to remove the titles from posts and not pages, you must delete the part of the code that says:
|| is_page()
- Open your theme’s stylesheet and add this CSS code:
.hidetitle .entry-title {
display:none;
}
Note 1: The above code will allow for the CSS to display accurately.
Note 2: This technique is suitable for WordPress themes that have the entry-title in their post or page title codes.
CSS Class Used for Your Theme’s Post Titles
Do the following steps to find out the type of CSS class your theme is using in its post titles:
- Open the particular post in Chrome or Firefox.
- Let your mouse hover over the post title.
- Right click on the post title and select the Inspect Element option.
Note: After completing all the steps above, the source code for the particular post title will be highlighted. You can, therefore, see the CSS class that your theme is using. Here’s an example, if your theme is using article-title for its CSS class. Just change it into this:
.hidetitle .article-title {
display:none;
}
Note: The technique above will work for most WordPress themes.
Removing Titles in Single Posts and Throughout the Site
In the techniques we mentioned above, keep in mind that although the titles are hidden, they’re not removed from your theme’s template. If you want to totally remove the titles from the templates, you need to remove the the_title code. For single post views, you will find the code in the single.php file.
Now, if you want to remove the titles in all posts and pages, you need to edit files such as single.php, index.php, and archive.php.
Which Method to Use and Why
If you’re a beginner at WordPress, you might find the steps we mentioned above to be a bit overwhelming. For the sake of learning, you can try editing your theme’s codes in a trial and error fashion. However, if you’re not up for such a challenge (yes, we’ve all been beginners once), we recommend using the plugin because it’s simpler and easier.
Rebecca’s strengths are in SEO and data analysis, but she also knows her way around WordPress pretty well, and is in charge of finding specific WordPress problems that people have, and then offer solutions.
Check our about page for more info.