Adding subtitle below post title

From Codex
Jump to: navigation, search

In some cases, some posts requires a second title right below main title.

Subtitle.png

To implement a subtitle function for your site Open single.php and paste this

<?php 
$subtitle = get_post_meta($post->ID, 'subtitle', true);
if ($subtitle !== '') {
	echo '<p class="subtitle">' . $subtitle . '</p>';
} ?>

right after

<h1 class="entry_title">
	<?php the_title(); ?>
</h1>

And paste this into custom.css box of theme options page

.entry .subtitle {
	color:#333;
	font:italic 25px/25px Georgia,Times,serif;
	margin-bottom:25px;
}

Now, you can use custom fields to display a second title on single post pages. Custom field name subtitle and include any text you want to display on single post page into the value field.

Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox