Home > Article > CMS Tutorial > How to hide title in wordpress
Hide optional articles and page titles
If you don’t want to hide optional articles and pages through code For titles, you can install and activate the WordPress Hide Title plugin. In the editing window of the corresponding page or article, click the item that needs to be edited under the article and page menu under WordPress management. Under the editing window, there is a custom block with a hidden title:
Related recommendations: "WordPress Tutorial"
you All you have to do is check this checkbox and click the Update or Publish button and the plugin will hide the title on the single PV. This means that it will still be displayed on the homepage or other category pages, but it will no longer be displayed on a single PV.
This method is really convenient if you want to create a simple login page that does not display the article title.
Hide all WordPress posts and page titles
If you want to hide all posts and page titles on a single page, you can do so by modifying the theme.
The easiest way is to add the following code to the WordPress functions.php file:
This filter only displays a single post or page A class .hidetitle was added to the post_class() function. However, this filter only works if your WordPress theme supports post classes. If you want it to only work for articles, remove || is_page() from the code.
After adding this function, you also need to add this CSS rule to the theme style sheet.
In the above CSS, we have used the show CSS property to hide the post and page titles. However, this CSS rule only applies to WordPress themes that use the entry-title for post and page titles. Open the article in Google Chrome, move your mouse over the article title, right-click and select Inspect Element. You will see the code for the article title in the source code of the page, which contains the CSS class used by your WordPress theme. .
If the theme uses article-title as the CSS class of the article title, you only need to simply change the CSS as follows:
The above method applies to most WordPress themes. But these methods only hide the headers and do not prevent them from loading. If you want to remove post and page titles on your WordPress theme template, you need to delete the_title code in the theme file.
If you just want to implement it on a single PV, you only need to modify it in the single.php file. If you want to achieve this effect for the entire site, you may need to edit files such as index.php, archive.php, single.php, etc.
The above is the detailed content of How to hide title in wordpress. For more information, please follow other related articles on the PHP Chinese website!