18 responses to “Using WordPress Custom Fields: Subtitles”

  1. Travis

    The one problem I see with the subtitle is that it doesn’t show up in the actual post, just in the browser title bar. I’m sure that’s fine for SEO, but it doesn’t add anything for the reader unless they look up, which a lot probably don’t.

    Still and interesting idea, and I’ll be watching to see how else you implement the custom fields – I’m sure there’s some great uses yet to be figured out.

  2. Justin

    Yeah, stay tuned. We could add the same snippet of code used to show the subtitle in the browser bar to show it in the actual post.

  3. links for 2007-11-15 | SridhaReena

    [...] Using WordPress Custom Fields: Subtitles: How to create post subtitles “This is the first post in what I hope to be an ongoing series of how to use WordPress’ custom fields.” (tags: WordPress custom fields subtitles customfields) [...]

  4. David

    Hi Justin,
    Does your code go between the ? So I delete what is inside of title now? Or do I delete title all together? Thanks!

  5. David

    whoops looks like it didn’t like my explanation because it mistook some of the HTML. Any, does your code go between the open and close of title, or do I delete the title code, or? thanks again!

  6. Justin

    David, this code goes between the opening and closing <title> tags. You should delete anything else between those tags.

  7. Voter

    Thanks for this tip and the “costum field” series!

  8. Andy

    I believe that custom fields could be used for creating a ‘Classified Ads’ area in a blog/cms site. Plugins like the Custom Write panel and the custom_field_gui could be used to make advert placement easy for users.
    I haven’t found any workable plugin as yet for a free classifieds
    Any thoughts?

  9. billso

    Sweet! I’ve been looking for some code to help me on my site. You saved the day!

  10. Add subtitles to Wordpress posts and pages using Custom Fields - tutorial

    [...] a nice tutorial: http://justintadlock.com/archives/2007/10/16/using-wordpress-custom-fields-subtitles Bookmark and share: These icons link to social bookmarking sites where readers can share and [...]

  11. Des Walsh

    Obviously I’ve not done something correctly. Followed the steps in the tutorial, published this post: http://webarts.net.au/wordframe-demos-soon-for-europe-and-asia-time-zones/
    and got the subtitle but multiplied twice – i.e. three iterations

  12. Mark

    A little tweak to this, and you can have post subtitles working as well (see example here, below the title in italics). Many thanks for the good information above.

    Note: I’ve attempted to format this a bit. Apologies if it ends up ugly.

    1 – Add a custom field entitled ’subtitle’ to a post, as described above.
    2 – From the Theme Editor, open the Main Index Template (index.php)
    3 – Search for the opening paragraph declaration entitled class=”post-info”
    4 – Paste the following BEFORE (immediately after the Title): ID, ’subtitle’, $single = true); if($subtitle !== ”) { ?>
    5 – Save and open the Single Post Template (single.php)
    6 – Repeat Steps 3/4
    7 – Save and open Stylesheet (style.css)
    8 – Search for post-info
    9 – Wherever you have your post-info defined (look for font-size, color, margin, etc), add , #content. subtitle before the opening bracket ({)
    10 – Immediately below (after the closing bracket), paste in the following: #content .subtitle { color: #265e15; font-style: italic; padding-bottom: 10px; }
    11 – Of course, change the color/font to match your theme…
    12 – Now, test! Open up your main page (index.php), and ensure all is displayed correctly. Also, open up a single post and make sure it is also displayed correctly.

  13. Mark

    Trying again… I feared something would be stripped. Didn’t realize the ‘code’ tag worked here… oops. :) Step 4 should be as follows…

    4 – Paste the following BEFORE (immediately after the Title): ID, 'subtitle', $single = true); if($subtitle !== '') { ?>

  14. Subtitler, My First Wordpress Plugin: Put Subtitles on your Blog | SpiderMarket

    [...] obvious that WordPress isn’t designed perfectly for it. There are an awful lot of bloggers[1][2[3], and there is even one company that claims to have a plugin for subtitles but hasn’t [...]

  15. Talking to WP Theme Developer Justin Tadlock « Web and New Media

    [...] Themes. I have used some of Justin’s articles and tutorials before, especially his series on using custom fields are very useful for learning about the power of this feature. He kindly answered some of my [...]

  16. Paula’s Page »  Wordpress Theme Hacks
  17. The Blog of Hanas › Dave Hanas finds random links around the web

    [...] Using WordPress Custom Fields: Subtitles If you want to create a sub-heading on a page underneath your main heading, this is the article to read… (tags: blog tutorial wordpress) Filed in Uncategorized | Comments (0) [...]

  18. diszk

    Jeez dude, u save my day:) thanks

Leave a Reply

By submitting a comment here you grant this site a perpetual license to reproduce your words and name/web site in attribution.

WordPress-o-Sphere

  • WordPress 2.8 – "Baker"
    WordPress 2.8 adds hundreds of bug fixes, adds cool functions for themes, boasts a new widget API, and makes custom taxonomies easy for end users.
  • WeRockWP
    WeRockWP recognizes and showcases the individuals who contribute much to the WordPress community. These individuals are called WordPress Rockstars.
  • wpazo
    The all-signal, no-noise, source for the best WordPress stuff.
  • BuddyPress 1.0 has arrived
    The long-awaited BuddyPress (a set of plugins that turns a WordPress MU install into a social network) has been officially released.
  • BuddyPress for WordPress (not MU) coming
    It looks like BuddyPress will also be released for normal WordPress installs (not just WPMU).