skip to Main Content

Alter Page Title Subheading

The following snippet can be used to modify the page header title subheading text. In this example you can see how you could remove the default subheading on the author archives or how you could add a custom subheading for a custom post type.

/**
 * Modify the page title subheading.
 *
 * @link https://total.wpexplorer.com/docs/snippets/alter-page-subheading/
 */
add_filter( 'wpex_post_subheading', function( $subheading ) {

    // Remove author subheading.
    if ( is_author() ) {
        return '';
    }

    // Display a custom subheading for my_post_type posts.
    if ( is_singular( 'my_post_type' ) ) {
    	$subheading = 'My Post Type Subheading';
    }

    return $subheading;
} );
All PHP snippets should be added via child theme's functions.php file or via a plugin (we recommend Code Snippets)
Back To Top