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!
9 Responses
Leave a Reply
Search
Categories
Recent Posts
- How to Choose a Web Host
0 Comments - Ovaltine Cleans Its Can
3 Comments - How to Add Subtitles to WordPress
9 Comments - Spicier New Slim Jim Logo
2 Comments - Ingredients of a Bad Website
0 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
July 16th, 2010 at 2:39 pm
I think what is making it not work for you is the space between the first “<” and “?php”. Delete the space.
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
Great tip. I just wish you attached screenshots to the article. It’s difficult to imagine how these subtitles look like when coupled with WordPress blog titles if you’ve been seeing just titles since the blogging platform was launched.
Reply
Oh, duh! My bad. There they are. Can the subtitles appear just below the title on the main page, before the jump? It looks out of place when it’s below the date, appearing more like a blurb than a subtitle.
Reply
[…] was looking to add subtitles to my posts. I found the answer over at Clever Carrot: In your WordPress editor simply add « subtitle » in the custom name field […]