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!
18 Responses
Leave a Reply
Search Archives
Categories
Recent Posts
- How to Choose a Web Host
0 Comments - Ovaltine Cleans Its Can
3 Comments - How to Add Subtitles to WordPress
18 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 […]
Does anyone know of a good WordPress course that really teaches this stuff I need one bad thanks.
email me at cman7@inbox.com.
Reply
OMG. This is exactly what I needed. I was using a plugin that was totally crapping out… but this works flawlessly!
Reply
Worked like a charm! Thanks so much!
Reply
This is great. I’m a total newbie, and following your instructions managed to get the value to appear in the right place, but I’m now trying to figure out how to define the style for my subtitles. Do I need to add the field to my style sheet? I’m sure it’s a stupid question, but any chance you could help? Thanks.
Reply
Great little post!
I’ve not only managed to easily put subtitles on my site, but also I’ve instantly learnt what custom fields are and how they work!
A whole new world to explore… thank you!
Reply
THIS IS SUPER HELPFUL! thanks a lot!
Reply
I can’t find a menu item called “Custom Fields”
Reply
June 15th, 2011 at 8:10 am
You might have to click on Screen Options in the top right of the Posts screen and check off Custom Fields so they appear.
Reply
I found Custom Fields…The code doesn’t work at all, for me (it just appears as code on my blog pages, so I have had to remove it…I’ve tried it with and without the { } and I’ve also tried it with < ?php and with <?php — all to no avail…
Reply