Add subtitles (subheadings) to your pages, posts or custom post types.
The WP Subtitle plugin allows your pages and posts to contain a subtitle. Also called a sub-heading, this this short line of text is meant to appear beneath a post's (or page's) title, but can be inserted in your template wherever you choose.
<?php the_subtitle(); ?>
is used for inside The Loop. If you wish to get a page/post's subtitle outside The Loop, use <?php get_the_subtitle( $post ); ?>
, where $post is a post object or ID ($post->ID).
Just like WP's built-in <?php the_title(); ?>
method, <?php the_subtitle(); ?>
tag accepts three parameters:
$before
(string) Text to place before the subtitle. Defaults to "".
$after
(string) Text to place after the subtitle. Defaults to "".
$echo
(boolean) If true, display the subtitle in HTML. If false, return the subtitle for use in PHP. Defaults to true.
Things are slightly different in <?php get_the_subtitle(); ?>
:
$post
(int|object) Post, page or custom post type object or ID.
$before
(string) Text to place before the subtitle. Defaults to "".
$after
(string) Text to place after the subtitle. Defaults to "".
$echo
(boolean) If true, display the subtitle in HTML. If false, return the subtitle for use in PHP. Defaults to true.
For full details on the template tags and their arguments, view the documentation here.
By default, subtitle are supported by both posts and pages. To add support for custom post types use add_post_type_support( 'my_post_type', 'wps_subtitle' ).
- Upload the WP Subtitle plugin to your WordPress site in the
/wp-content/plugins
folder or install via the WordPress admin. - Activate it from the Wordpress plugin admin screen.
- Edit your page and/or post template and use the
<?php the_subtitle(); ?>
template tag where you'd like the subtitle to appear.
For full details on the template tags and their arguments, view the documentation here.
What does WP Subtitle do?
The plugin adds a Subtitle field when editing posts or pages. The subtitle is stores as a custom field (post meta data) and can be output using template tags.
Where does WP Subtitle store the subtitles?
All subtitles are stored as post meta data. Deactivating this plugin will not remove those fields.
How do I add the subtitle to my pages?
Refer to the documentation.
How do I add support for custom post types?
To add support for custom post types use add_post_type_support( 'my_post_type', 'wps_subtitle' ):
function my_wp_subtitle_page_part_support() { add_post_type_support( 'my_post_type', 'wps_subtitle' ); } add_action( 'init', 'my_wp_subtitle_page_part_support' );
Where can I get help?
Please post support requests and questions in the WordPress.org Support forum.
How should I report a bug?
Please submit bugs/errors directly to the GitHub Issues list.
How can I contribute code?
The plugin is hosted on GitHub and pull requests are welcome.
Added quick edit support for subtitle. Security Update: Sanitize $_REQUEST
and $_GET
when establishing post type in the admin.
Add [wp_subtitle] shortcode. Do not use variable for textdomain - causes issues for parsers.
Fix PHP notice warning on 404 error page.
Add subtitle admin column.
Security Update: Ensure subtitles are sanitized when saving.
Prevent subtitle fields from displaying on unsupported post types and fix issue with quotes in subtitles.
Subtitle field moved to below title field (only in WordPress 3.5+)
Fixed static method warnings and only load admin functionality when needed.
Added custom post type support and support for more recent versions of WordPress.
Initial release.
View a list of all plugin changes in CHANGELOG.md.