Making WordPress page headings different from the menu items

Php Programming Key Shows Internet Development LanguageJust a quick WordPress tip this time for theme developers, or people who just want to customize a WordPress theme they’ve purchased.

Sometimes there are reasons to make a menu item slightly different from the title of the actual page. Perhaps your menu space is limited, but you have plenty of room in the content area. A typical example is using “FAQ” in the menu, but then the page heading actually shows “Frequently Asked Questions.”

A great way to accomplish this is the Custom Fields in WordPress, combined with a bit of theme customization.

Normally, you would insert the title of a page like this:

<?php the_title(); ?>

Instead, you can create a custom field. We’ll call it “custompagetitle” for this example. On the FAQ page, you would enter ‘FAQ” as the title of the page, then a custom field called “custompagetitle” and enter “Frequently Asked Questions” there. Then, instead of the previously mentioned code, insert this code:


// See if there's a custom field custompagetitle,
// and if so, use it as the page's title

$realtitles = get_post_custom_values('custompagetitle');

if (is_array($realtitles)) {

$realtitle = implode($realtitles);


if ($realtitle)

echo $realtitle;




Not only does this code use your custom heading, but if there is no custom heading, it will default to the actual page title.


  1. With WordPress 3.0, this is no longer necessary if your theme uses the new menu system. That lets you rename the page at the menu level instead of the other way around, like we described in this article.

Leave a Reply

Your email address will not be published. Required fields are marked *