How to Add the Subtitle Below the Title

Home » Tutorials » Theme Tutorials » How to Add the Subtitle Below the Title

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

Subtitle

To implement the subtitle, add this code to your single.php file:

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

Below this code:

<h1>
	<?php the_title(); ?>
</h1>

Finally, add this code to your Custom CSS box:

.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.

LEAVE A COMMENT