Optimize WordPress Page Headings

1955_ad.gifNote: This post has been republished due to new interest in it. In addition, more detailed information and instruction has been included with the post.

I have always thought that one of the main flaws of many WordPress themes is that the main page navigation, when called by using the wp_list_pages() function, applies a title to each of the navigation links with whatever value is used in the the_title() of that particular page.

Don’t get me wrong, this is a good idea, but because of the way most navigation links are designed, the page titles need to be quite short and not very descriptive. Similarly, these themes tend to also use the_title() as the main H1 or H2 tag for the page display itself. In other words, if the navigation link says “Home”, the page title for that page usually displays as “Home” as well. This may be the way a designer wants it, but often it seems that a more descriptive page title is what’s really needed.

… it also allows for keyword insertion into these page titles - something that can only increase page rankings in the search engines.

By applying a nice bit of coding and sharing it with the world, Mike Cherim gave me the idea about how to solve this problem. I adapted the code he uses to display WordPress pull quotes, and now use it to afford the WordPress user the option to add their own, more descriptive page title rather than relying on the_title() alone. By using Mike’s technique, along with the built in custom fields feature of WordPress, the user is not required to to add a more descriptive page title, and if they don’t, the code defaults to using the_title() as normal. However, it does afford the user the option to be more descriptive in their page titles. Not only is this a neat feature that allows for more descriptive titles, but it also allows for keyword insertion into these page titles - something that can only increase page rankings in the search engines. After all, which H1 page heading is more SEO friendly, “Home” or “Welcome to LifePlan Financial“?

The code below shows how I implement the page titles in the PHP code. (Sorry, I could not get the actual PHP code to display correctly in this post, so what you see below is an image.)

main_title.jpg

Essentially, the code above says the following: If the custom field named main_title is NOT empty, display the text contained in that field as the H1 title. If the custom field named main_title IS empty, display the standard WordPress the_title() tag as the H1 title.

Putting the Code to Work for You

Based upon our example above, let’s put this into action. We’ll add one custom field called “main_title”. The following instructions will demonstrate how to add this information to a post using Custom Fields.

  1. From the Write Post panel, choose Advanced Editing. If you are using the Simple Editing screen, look for a button with Advanced Editing » next to the Publish button. Click the button to go to the advanced editing screen.
  2. After you have written your post, scroll down to the bottom of the Advanced Editing screen and look for an area titled Custom Fields.
  3. To create a new Custom Field called “main_title”, enter the text “main_title” (without the quotes) in the text entry field titled Key.
  4. The newly created Key should now be assigned a Value, which in our case is the name of H1 title you would like displayed on your page. Type this text in the Value field, again without the quotes.
  5. All done. If I explained this correctly, and you followed the directions, your WordPress pages will now display the custom page title field!

You can add a page title to each of your WordPress pages meta-data. In the Custom Fields section, the Key will now feature a pull down list with the previously entered Custom Fields. Choose “main_title” and then enter the new page title in the value. Click Add Custom Field.

You only need to create a new “KEY” once, after which you can assign a value to that key for every post, if you so desire. If you do not enter any value in the main_title key, the code I wrote will default to using the standard WordPress page title contained in the_title() function

You can see this technique in action right here at 1955 Design. Just navigate the menu and see what titles I have chosen to add to the pages, rather than just the default navigation text. I think it’s a great idea, and thank Mike for both the code and the concept.

[eof]


del.icio.us| Digg| blogmarks| Ma.gnolia| StumbleUpon| Technorati|

18 Comments & Trackbacks to “Optimize WordPress Page Headings”

Clever idea, David. Especially for WP “Pages.” You could write a short fits-in-your-nav-menu title for a page using WP, while still having a longer, more descriptive title for the actual page. Outstanding.

Just keep coming up with these great ideas Mike, and funnel them my way, and once in a great while it will prompt me to come up with another idea of my own. Now if I could only have thought of the original idea in the first place. :-)

Found your blog via Megan McDermott’s blog. Great tips, I’m going to go apply this to my blog as well :)

Thanks for stopping by, Adam. It’s a neat way to spice up your page with some great titles. Works really great. Let me know if you have any difficulty implementing it.

Looking to start my own blog so anytime I see tips they are a must read. Found your site through lazymanandmoney.com, love the new design and that’s for the great tips.

Thanks for stopping buy, Used Vans Girl. I appreciate the visit and the comment.

Thanks for stopping by, Darren. I really appreciate the visit and the comment.

@BpMonaco: My thanks to you as well, Brennan, for stopping by and for the link to your blog.

@Deyaert: Thanks for paying a visit to 1955 Design!

Ive been looking for a way to change my H1’s for a while now and I finally stumbled across your site. This little bit of coding is AWESOME and adds so much more to my site! David, great job reworking pullquote code to work for the H1 issue, its a definite bonus to any site! Thanks again for your help and your innovative solution!

@Endure: Thanks for the comments. I was glad to help out with your H1 tags. I think the your site looks terrific with those new page titles!

@Mike Cherim from GreenMethods.com - Thanks for the kind words, Mike. The inspiration comes from you and always has.

I can hardly wait to roll up my sleeves and look at your new GreenMenthods project in greater detail.

6 Trackbacks to Other Blogs

Enter Your Details

  • First time commenters will have their comment moderated before it appears.
  • If there is a link in your comment, it will also require moderation.
  • This site uses Akismet to stop Spam in it's tracks.
  • So, if you are sending Spam, just forget about leaving a comment, OK?

Please Leave Your Comments Below