Tuesday, June 12, 2012

WordPress: Hide Page Title or Post Title on a Case by Case Basis

WordPress: Hide Page Title or Post Title on a Case by Case Basis


WordPress: Hide Page Title or Post Title on a Case by Case Basis

Posted: 12 Jun 2012 08:00 AM PDT

WordPress Hide Page Title - Featured Image: Dog Under Blanket
Those of us who want WordPress to be more than a blogging system often find that we need to bend and twist and shape it to do things that might at first seem counter-intuitive: hide a Page title, for example, or even remove a Post title.

There are all sorts of good reasons to want to do one of the above. A common one might be that you're using a Page as your homepage instead of the default stream of posts that many themes use, and you don't want a title getting in the way of your custom look. Another might be that you're using a Page as a landing page, and again, the out-of-the-box title simply gets in the way.

How to Hide Your WordPress Titles on Pages or Posts

If you'd like to remove your titles on specific Pages or Posts, then there are a few different ways to go about it.

The Quick, Easy, Dirty Way

The easiest way, of course, is to simply not put a title in the title box. Yes, this is actually possible, but there's a trick to it.

If you try to publish a Page without a title, it won't publish. A Post, on the other hand, will publish without a title.

So the way to get around a Page not publishing is to first publish it with a title and then go back and simply delete the title. Problem solved.

When you do this, of course, in your Admin area you get the (no title) place holder where your title is meant to go.

No title in the Amdin Area

 

While this works, let's be honest: it's pretty artless. And we're better than that, aren't we? … AREN'T we???

That's better.

But seriously, while this trick does work, who knows if one day it suddenly won't. WordPress has already made it so that you can't publish a Page without a title straight away, and so the time may come when even a pre-published Page without a title will revert to an unpublished state. In addition, of course, you’re stuck with “no title” as your title in the Admin area. If you have more than one of these, it will add yet one more small pain to your admin life.

A Better Way to Remove Page and Post Titles

While it is possible to dig into your theme's files and change some title tag code to something conditional (if “Page X” then don’t show, if not then show), perhaps a better way is to hide the title of specific Pages or Posts with CSS in your stylesheet.

Step 1 – Find the Title Class Name

The first thing you will want to do is to find the name of the "class" associated with your title tag.

Maybe the easiest way to do this is to simply navigate to an already published Page on your site, and then look at the source code.  (Right click on the page and then go to "View source/ page source.")

From there, search for the title of your post. You will likely come across it a number of times before you find the section you need, which is the title that sits just above your content, most likely wrapped in h1 tags.

It will look something like the following.

WordPress Page Title CSS Class Code

The class in the example above is "entry-title." There is a very good chance that yours will be named the same, but it can be different if your theme developer decided to give it a different name.

Once you have the name of the class, note it down. You'll be using it in a minute.

 

Step 2 – Find the Page or Post ID

Next you'll want to find the ID of the Page or Post that you want to remove your title from.

If you're unsure how to do that, then see the following post: How to Find the IDs of WordPress Categories, Posts, Pages, and More. You can also find the ID by looking in the same area where you found the name of your class above.

Finding Post ID

Once you have that, note it down.

Step 3 – Insert Code into Stylesheet

Next you'll want to go to your theme's stylesheet. (Appearance > Editor > Stylesheet – style.css)

 

FOR PAGES:

At the bottom of the stylesheet, use the following CSS example for Pages:

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

As you can see, I've used my Page ID (1826) and the name of the class for my title (entry-title). Don't forget to include the dots as you see in the example.

 

FOR POSTS:

The CSS code for Posts is similar, but it's not the same. Here's an example for Posts:

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

Again, you'll notice that I've included my Post ID (1773) and the class name for my title (entry-title).

Once you put this code in your CSS file and save it, the title on that page will disappear.

 

The Result

And that's it. Here's a look at my before and after (with title and without title).


Photo: a chihuahua mix dog under a red blanket from BigStock

Related posts:

  1. Daily Tip: Select Sidebar on a Post-by-Post Basis Using Custom Fields If you’ve every wanted to use different sidebars for different...
  2. How to Add Post Thumbnails to the WordPress Post and Page Management Screens If you’re producing a lot of content on your WordPress...
  3. How to Widgetize a Page, Post, Header or Any Other Template in WordPress Have you ever found a plugin for a widget that...

12 Fantastic Presentations from WordCamp NYC

Posted: 12 Jun 2012 07:00 AM PDT

If you didn’t have the chance to attend WordCamp NYC, you can still check out some of the presentations through the slides posted by the presenters. The slides don’t tell you everything, but they can certainly provide a starting point for learning more about a topic that’s new to you. Here’s a small taste of what you missed from the sessions.

Making Millions of Websites More Accessible


By Aaron Jorbin

Killer Docs For Killer Devs

Developing Digital Marketing into Your WordPress

Supporting WordPress

Express Yourself With BuddyPress Themes

Creating WordPress ChildThemes

Using Git for Sane WordPress Development


By Boone Gorges

Google loves WordPress – Blogging For SEO

WordPress for Nonprofits Using CiviCRM

Customizing the Custom Loop

Making Custom Content Management Disappear into the WordPress Admin

WordPress Security

Related posts:

  1. WordCamp NYC in Review: A Collection of Slide Presentations for WPMU and BuddyPress If you’re like me and were not able to make...
  2. Daily Tip: Get Info About WordCamps at WordCamp Central Want to attend a WordCamp this year? Find one near...
  3. Daily Tip: WordCamp Miami 2012 Presentation on Creating a Niche Social Network Using Multisite and BuddyPress If you're thinking about creating a social network with Multisite...

Daily Tip: Restrict WordPress Registration With Invitation Codes

Posted: 11 Jun 2012 04:22 PM PDT

Not every WordPress site administrator wants to keep registration open to anyone and everyone. When you want to limit the site members to invited users only, you may want to try using invite codes.

BAW Easy Invitation Codes is a new plugin that allows you to create invitation codes, share them, track the codes, and track the users.

Codes are generated in the WordPress dashboard:

WordPress invitation code generation

Here’s what the registration form looks like with the code entry field:

 WordPress registration form with invitation code

This is a great plugin to consider if your site’s registration needs to be a bit more restricted. Download BAW Easy Invitation Codes for free from the WordPress plugin repository.

Related posts:

  1. Daily Tip: Restrict BuddyPress Email Domains at Registration BuddyPress Restrict Email Domains is a handy new plugin that...
  2. Daily Tip: How to Assign WordPress User Roles at Registration Add a user role dropdown select box to your WordPress...
  3. Daily Tip: How to Sort WordPress Users By Registration Date The Recently Registered plugin adds the ability to sort users...

No comments:

Post a Comment

Search This Blog

Top WordPress Seller