DPS, Use h2 for post title

<?php
/**
* Display Posts Shortcode, Use h2 for post title
* @see 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 );
view raw functions.php hosted with ❤ by GitHub

Original support ticket

Display Posts Shortcode