How to Hide Title from a Post or Page in WordPress
Do you want to hide the title from your post or page? This is a complete guide for you.
In this post, I will share three ways to hide titles from posts and pages. As these kinds of titles are sometimes unwanted. Like you don’t want to show that it’s homepage, while it’s already apparent and there is no need to put a title at the top of the homepage showing that it is a homepage. I will show you three ways to get rid of these titles.
Let’s get started…
The first method: By Using Plugin.
In the first method we will tell you, how can you hide the title of specific post or page using plugin. so just go to your WordPress dashboard » click on Plugins » Add New and search for Title Remover.
The first result will be from WP Gurus, with over hundred thousand active installations. Just install and activate this plugin. And now go to any page or post which you want to remove the title of. At the right of the post edit screen, you will see different meta-boxes including a new box named hide title. Check this hide title meta-box and update the post.
The title will be successfully removed.
The second method: By Writing a code-line.
In this method we will tell you, how can you hide the title of specific post or page by write a code in style.css and functions.php files.
Hide specific post title
Firstly, we have to check the ID of that particular post or page which we want to target. So for checking ID, we will select that particular post/page, and come to the post/page edit-screen and you will see the ID of your post in the URL bar.
Copy this ID and go to the appearance tab and click theme editor. You may get an attention notice, just proceed to the theme editor and don’t worry.
Navigate to your functions.php file and copy the below code and paste it in your editor.
function wpr_hidetitle_class($classes) {
if ( is_single() ) :
$classes[] = 'hidetitle';
return $classes;
endif;
return $classes;
}
add_filter('post_class', 'wpr_hidetitle_class');
In the second line of the code, write your post’s ID inside the is_single() parentheses and update the file.
(This code will add a class in the post’s container.)
Now we have to check the class of our title. For checking the class of a post title, we will come to the front-end, right-click on the title of the post, and click inspect element.
We will copy this class and head back to the editor.
Navigate to style.css file, write the below code in it, and update file:
You can also add this css to Appearance » Customise » Additional Css or to any plugin that allows you to add custom css like WP Add Custom CSS plugin, instead of style.css
.hidetitle .entry-title {
display: none;
}
The title will be removed and hidden.
Hide specific page title
In case of removing the title from a page, go to functions.php file and now instead of is_single() write is_page() to remove the title of the single page and insert the ID of the page you want to target, inside the parentheses, and update the file.
The third method: Bulk Removing of Titles.
In previous methods, we discussed how to remove titles from individual posts or pages. But if you want to hide titles from all posts and pages at once, the plugin method will remain the same. We just have to check the hide title button from meta-boxes and update posts ????.
In the coding method, we will change a line from our code.
So we will head over to our functions.php file and just leave the parentheses of is_page() blank and add || is_single()
after it like this:
And now we will update the file.
All the titles of posts and pages will be hidden successfully.
Hide Titles of All Posts
We will use the following code for hiding the titles of all posts:
function wpr_hidetitle_class($classes) {
if ( is_single() ) :
$classes[] = 'hidetitle';
return $classes;
endif;
return $classes;
}
add_filter('post_class', 'wpr_hidetitle_class');
Hide Titles of All Pages
And this code will be used for hiding the titles of all pages:
function wpr_hidetitle_class($classes) {
if ( is_page() ) :
$classes[] = 'hidetitle';
return $classes;
endif;
return $classes;
}
add_filter('post_class', 'wpr_hidetitle_class');
Still confused! Check out this video for detailed information about the issue.
Video Tutorial
Here are a few tutorials for you to read next:
If you find this tutorial helpful, then please Subscribe to our YouTube Channel for video tutorials, and share this article on social media.