Skip to content
Ben Huson edited this page Dec 10, 2015 · 1 revision

Used to get the subtitle value for a specific post.

Usage

<?php get_the_subtitle( $post, $before, $after, $echo ); ?>

Parameters

$post
(int|object) (optional) Post ID or object.
Default: None Uses the current post.

$before
(string) (optional) Text to place before the subtitle.
Default: None

$after
(string) (optional) Text to place after the subtitle.
Default: None

$echo
(boolean) (optional) Display the subtitle (TRUE) or return it for use in PHP (FALSE).
Default: TRUE

Example

<?php $subtitle = get_the_subtitle( null, '', '', false ); ?>

Set the $subtitle variable to the subtitle of the current post.

<?php $subtitle = get_the_subtitle( 10, '<h3>', '</h3>', false ); ?>

Set the $subtitle variable to the subtitle of post with ID 10 in an H3 tag.