In just 3 easy steps you can have attractive subtitles on your WordPress site.
- Go to the edit screen for the post or page where you want subtitles.
- Under the Custom Fields heading, enter a new custom field name. Type subtitle in the Name field. Type the subtitle text in the Value field. Add the custom field.
- Add the below code in your post or page template after the title code (or wherever you want it to appear) and save.
< ?php
{ $subtitle = get_post_meta
($post->ID, 'subtitle', $single = true);
if($subtitle !== '') echo $subtitle;} ?>
Voila!
5 Responses
Leave a Reply
Search
Categories
Recent Posts
- Ovaltine Cleans Its Can
3 Comments - How to Add Subtitles to WordPress
5 Comments - Spicier New Slim Jim Logo
2 Comments - Ingredients of a Bad Website
0 Comments - 10 WordPress Plugins to Grow Great Sites
10 Comments



Hey thanks for the post, I think there is an error with the { and the } in the code, once I remove those it works like a charm. I haven’t updated to the latest wordpress yet so it might just be for the older version.
ID, ‘subtitle’, $single = true);if($subtitle !== ”) echo $subtitle; ?>
Thanks again
Reply
March 16th, 2009 at 7:06 pm
That’s odd that there would be an error. For PHP expressions, { is always the beginning and } is the end. Could you email me the code you used? I don’t see it on your site.
Reply
Hi,
thanks for the tip. However, how do I get the subtitles showing under the title under the next and previous post links when viewing only one post?
Reply
How would I go about adding a subtitle to my Page title, so that it in the menu the Page title displays and underneath the subtitle displays?
Reply
Tx ! We don’t need any plugin.
It was just the snippet I was searching for. Custom fields are fantastic.
Reply