WordPress is a famous blogging platform. Most of the blogs on Internet are built with WordPress.
Sometimes it requires adding a subtitle to posts and pages in your WordPress theme.
Add a subtitle to posts and pages in your WordPress theme.
Here I am going to show you how to add a custom subtitle below posts title and pages title.
To add a subtitle in your blog post the first thing you need to do is to install and activate the KIA Subtitle free WordPress plugin.
It’s a free plugin found in WordPress repository.
After successful activation of this plugin, you will see an additional subtitle field below your main title on your post edit screen.
You can enable this feature for media files, post, and pages in your WordPress theme. To enable it you need to go to Settings>>KIA Subtitle. Mark the required field and click ‘Save Changes’.
After this, you will need to add ‘the_subtitle()’ tag manually in your theme’s page/post template. Add this line of code
<?php if(function_exists('the_subtitle')) the_subtitle(); ?>
after ‘the_title()’ tag. This code will output the text written in subtitle input field.
You can also use the shortcode
[the-subtitle] to display it within the page content or post content.
You can, however, add this code to anywhere in the loop if you don’t want to show below the title.
You can wrap the function with some HTML tags and some CSS selector to apply CSS.
<p class='new-subtitle'><?php if(function_exists('the_subtitle')) the_subtitle(); ?></p>
All done. You will now be able to see a subtitle in your blog post. Just add a little CSS and you are ready to go.
Hope this post may useful to you. Comments are always welcome.