How to Add a Subtitle to WordPress Post and Page Titles

How to Add a Subtitle to WordPress Post and Page Titles

Subtitles can be quite handy for revealing more content to your reader for a better explanation of your post. Adding a subtitle to your WordPress posts seems like a small thing, but when you find out that it’s not built in, you’ll have to come up with a quick solution for site.

Of course you could always create a new custom field for subtitles and then add something like this to post loop after the title:

{code type=php}<?php
{ $subtitle = get_post_meta
($post->ID, ‘subtitle’, $single = true);
if($subtitle !== ”) echo $subtitle;} ?>

However, if you’re not comfortable modifying files, then you’ll want to install a plugin. Up until today there were several plugins out there for subtitles, none of which had been updated recently.

Visual Subtitle is a new plugin that handles the creation of subtitles in an entirely visual way, as opposed to keeping it as a separate entity. Here’s how it works: It allows you to include a string of text that will still be part of the post title, except it’s wrapped in a span tag, like this:

{code type=html}

This is the titleThis is the wrapped “subtitle”

 

The subtitle is separated with a pipe (|) character in the post screen and appended to the title part of the document title with a colon (:) character.

FREE EBOOK
Your step-by-step roadmap to a profitable web dev business. From landing more clients to scaling like crazy.

By downloading this ebook I consent to occasionally receive emails from WPMU DEV.
We keep your email 100% private and do not spam.

FREE EBOOK
Plan, build, and launch your next WP site without a hitch. Our checklist makes the process easy and repeatable.

By downloading this ebook I consent to occasionally receive emails from WPMU DEV.
We keep your email 100% private and do not spam.

This gives you the freedom to style the subtitle with your theme and make it appear to be separate from the main title. Make sure to add .subtitle { display: block; } to your CSS plus any other style you want to apply to the subtitle.

The end result gives you something similar to the screenshot above. You’ll even be able to view your subtitle in the post management and quick edit screens:

The Visual Subtitle plugin is available for free from the WordPress plugin repository. Download it and start adding some styles to get fancy post titles in under five minutes.

Tags: