dev-master
9999999-devAdds a subtitle field below the post title field in WordPress.
GPL-2.0+
by Micah Wood
Adds a subtitle field below the post title field in WordPress.
A module that adds a subtitle field below the post title field in WordPress., (*1)
composer require wpscholar/wp-post-subtitle
require __DIR__ . '/vendor/autoload.php';
The subtitle feature is activated by adding post type support., (*2)
If you are adding support to a pre-existing post type, just add this code:, (*3)
add_post_type_support( 'post', 'subtitle' );
Be sure to replace post
with the name of your post type., (*4)
Or, in the supports
argument when registering a post type, just add subtitle
., (*5)
The following static methods are publicly available (under the wpscholar\Wordpress\PostSubtitle
namespace):, (*6)
getSubtitle( $post_id )
- Get the subtitle for a specific post.setSubtitle( $post_id, $value )
- Set the subtitle for a specific post. If you are adding the code to a WordPress plugin or theme, there is no initialization step required. However, if you are adding the code at a higher level in your WordPress project you will need to call the initialization function on the after_setup_theme
hook, like so:, (*7)
add_action( 'after_setup_theme', '\wpscholar\WordPress\PostSubtitle::initialize' );
Adds a subtitle field below the post title field in WordPress.
GPL-2.0+