sandywp / plugins / wp-subtitle
WP Subtitle
Add subtitles (subheadings) to your pages, posts or custom post types.
Ready in seconds.
v3.4.2 10,000+ installs WP 5.6+ PHP 5.6+

What you get inside
4 screens-
Edit post screen (WordPress 5.0+ and WP Title 3.1+)
-
Edit post screen (WordPress 3.5+ and WP Title 2.2+)
-
Edit post screen (for earlier versions of WordPress or using the 'wps_subtitle_use_meta_box' filter)
-
A single page showing a subtitle
About this plugin
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.
The subtitle can be inserted into your theme template files (or plugin) using the following API:
Display The Subtitle
All parameters are optional. If ‘post_id’ is omitted then the current post ID in the loop is used.
PHP Code:
do_action( 'plugins/wp_subtitle/the_subtitle', array(
'before' => '<p class="subtitle">',
'after' => '</p>',
'post_id' => get_the_ID(),
'default_value' => ''
) );
Output:
<p class="subtitle">My Post Subtitle</p>
Get The Subtitle
All parameters are optional. If ‘post_id’ is omitted then the current post ID in the loop is used.
A default value can be supplied as the second parameter for apply_filters. This will be used if the post does not have a subtitle. Leave as an empty string to return an empty string if the post does not have a subtitle.
PHP Code:
$subtitle = apply_filters( 'plugins/wp_subtitle/get_subtitle', '', array(
'before' => '<p class="subtitle">',
'after' => '</p>',
'post_id' => get_the_ID()
) );
Result:
$subtitle = '<p class="subtitle">My Post Subtitle</p>'
Parameters
The array of arguments accepted for the plugins/wp_subtitle/the_subtitle action and plugins/wp_subtitle/get_subtitle filter are:
before
(string) Text to place before the subtitle if one exists. Defaults to an empty string.
after
(string) Text to place after the subtitle if one exists. Defaults to to an empty string.
post_id
(integer) Post, page or custom post type ID.
default_value
(string) Only used by the plugins/wp_subtitle/the_subtitle action, allows you to specify a default subtitle to display if the post does not have one. For the plugins/wp_subtitle/get_subtitle filter the second parameter of apply_filters should be used instead. Defaults to to an empty string.
Post Type Support
By default, subtitle are supported by both posts and pages. To add support for custom post types add teh following to your theme functions file or plugin:
add_post_type_support( 'my_post_type', 'wps_subtitle' )
WooCommerce Plugin Support
Subtitles can automatically be added to your WooCommerce products without needing to make template changes. In the admin go to WooCommerce > Settings > Products where you can choose to:
- Enable Product Subtitles
- Display the subtitle on single product pages
- Display the subtitle on product archives (category pages)
Yoast SEO and SEOPress Plugin Support
The plugin allows you to include the subtitle in your meta titles and descriptions via the Yoast SEO and SEOPress plugins.
Similar to the Yoast %%title%% placeholder which inserts the post title, you can use %%wps_subtitle%%.
There are also addition placeholders and filters to allow to to customize seperators for the subtitle.
For more information, view the SEO support documentation here.
Questions
- What does WP Subtitle do?
The plugin adds a Subtitle field when editing posts, pages or custom post types. The subtitle is stored as a custom field (post meta data) and can be output using API actions and filters.
- Where does WP Subtitle store the subtitles?
All subtitles are stored as post meta data. Deactivating this plugin will not remove those fields.
- Compatibility with WordPress 5.0+
In the new editor in WordPress 5.0 the subtitle is editable via ap panel in the sidebar (like excerpts).
- 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 add the following to your theme functions file or plugin:
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.
sandywp / also on the shelf
Try another plugin
4.3 · 1M+ installs
Import your demo content, widgets and theme settings with one click. Theme authors! Enable simple theme demo import for your…
4.3 · 80K+ installs
Control the appearance of WordPress post excerpts
2.7 · 20K+ installs
Make your website look like the live demo of the theme with a click!
Spin up a real WordPress site in seconds.
Test plugins, build a demo, hand a client a link — then squash it and start again. No local setup, no Docker.