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
- 12 Fantastic Presentations from WordCamp NYC
- Daily Tip: Restrict WordPress Registration With Invitation Codes
WordPress: Hide Page Title or Post Title on a Case by Case Basis Posted: 12 Jun 2012 08:00 AM PDT
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 PostsIf 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 WayThe 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.
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 TitlesWhile 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 NameThe 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. 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 IDNext 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. Once you have that, note it down. Step 3 – Insert Code into StylesheetNext 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 ResultAnd 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:
|
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 AccessibleKiller Docs For Killer Devs Killer Docs for Killer Devs View more presentations from spmckeown Developing Digital Marketing into Your WordPressSupporting WordPress Supporting WordPress View more presentations from masonjames Express Yourself With BuddyPress ThemesCreating WordPress ChildThemesUsing Git for Sane WordPress DevelopmentGoogle loves WordPress – Blogging For SEOWordPress for Nonprofits Using CiviCRMCustomizing the Custom LoopMaking Custom Content Management Disappear into the WordPress AdminWordPress Security WordPress Security from WordCamp NYC 2012 View more presentations from Brad Williams Related posts:
|
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: Here’s what the registration form looks like with the code entry field: 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:
|
You are subscribed to email updates from Wordpress Themes, Plugins, Tutorials & More - WPMU.org To stop receiving these emails, you may unsubscribe now. | Email delivery powered by Google |
Google Inc., 20 West Kinzie, Chicago IL USA 60610 |
No comments:
Post a Comment