Hide a page or post title

Sometimes you don’t want the title of a page or post to be displayed, but you still want to give it a title. Here’s how, thanks to the great folks (Joe Foley in this case) at WPMUDev.org (premium.wpmudev.org/blog/wordpress-hide-page-title-or-post-title-on-a-case-by-case-basis):

  1. Create the page or post, with the title you want. Publish it.
  2. Look at the code of the page, and find the id for the page/post , and the class of the title (graphics from WPMUDev):finding-post-idwordpress-page-title-css-class-code
  3. Now insert the following code into the stylesheet:
    If it’s a page:

    .page-id-1826  .entry-title {display: none;}

    If it’s a post:

    #post-1773 .entry-title {display: none;}

Here’s the result (image again from WPMUDev.org):

removing-wordpress-page-title-before-and-after

Some themes (such as the popular Responsive theme) have ways to add custom CSS built in; if so, use that. If not, the proper way to add custom CSS is to create a child theme and edit the stylesheet for the child theme. You can directly edit the stylesheet of the theme itself (Appearance > Editor > Stylesheet – style.css), but the problem with this approach is that, when you update the theme, your custom css will most likely be lost, as you are likely to download and install a new stylesheet as part of the theme updating process.

 

Bookmark the permalink.

Comments are closed.