DPS, Use h2 for post title

 * Display Posts Shortcode, Use h2 for post title
 * @link https://www.billerickson.net/code/dps-use-h2-post-title/
function be_dps_post_title_h2( $output, $original_atts, $image, $title ) {
	if( !empty( $original_atts[ 'post_title_as_h2' ] ) && true === filter_var( $original_atts[ 'post_title_as_h2' ], FILTER_VALIDATE_BOOLEAN ) ) {
		$new_title = '<h2>' . $title . '</h2>';
		$output = str_replace( $title, $new_title, $output );
	return $output;
add_filter( 'display_posts_shortcode_output', 'be_dps_post_title_h2', 10, 4 );

Original support ticket

Bill Erickson

Bill Erickson is a freelance WordPress developer and a contributing developer to the Genesis framework. For the past 14 years he has worked with attorneys, publishers, corporations, and non-profits, building custom websites tailored to their needs and goals.

Ready to upgrade your website?

I build custom WordPress websites that look great and are easy to manage.

Let's Talk