How to change H tag in page headline?

Title in page headline is, by default, set to use h1 tag.


In order to change the tag, you will need to customize part of the theme's code, so some familiarity with PHP is necessary.

First, install and activate the child theme. Then, to child theme's functions.php file add the following code, and edit the H tag according to your needs:

if ( ! function_exists( 'boldthemes_get_heading_html' ) ) {
    function boldthemes_get_heading_html( $superheadline, $headline, $subheadline, $headline_size, $dash, $el_class, $el_style ) {
        if ( $superheadline != '' ) {
            $superheadline = '<div class="btSuperTitle">' . wp_kses_post( $superheadline ) . '</div>';
        }
        if ( $subheadline != '' ) {
            $subheadline = '<div class="btSubTitle">' . wp_kses_post( $subheadline ) . '</div>';
        }
        
        $h_tag = 'h1';
        $class = '';
        $style_attr = '';
        if ( $el_style != '' ) {
            $style_attr = 'style="' . esc_attr( $el_style ) . '"';
        }
        if ( $headline_size != 'no' ) {
            $class .= $headline_size;
        }
        if ( $headline_size == 'extralarge' || $headline_size == 'huge' ) {
            $h_tag = 'h1';
        } else if ( $headline_size == 'large' ) {
            $h_tag = 'h2';
        } else if ( $headline_size == 'medium' ) {
            $h_tag = 'h3';
        } else {
            $h_tag = 'h4';
        }
        if ( $dash == 'yes' ) {
            $dash = 'top';
        }
        
        if ( $dash != 'no' && $dash != '' ) {
            $dash = str_replace( ' ', 'Dash ', $dash );
            $class .= ' btDash ' . $dash . 'Dash';
        }
        if ( $el_class != '' ) {
            $class .= ' ' . $el_class;
        }
        
        $output = '<header class="header btClear ' . $class . '" '="" .="" $style_attr="">';
        
        $output .= $superheadline;
        
        
        if ( $headline != '' || $subheadline != '' ) {
                $output .= '<div class="dash">';
                    $pattern = "/<(b|u|i|em|del)([> ])/";
                    $replace = '<$1 class="animate">';
                    $headline = preg_replace( $pattern, $replace, $headline );
                    if ( $headline != '' ) {
                        $output .= '<' . $h_tag . '><span class="headline">' . $headline . '</span><!--' . $h_tag . '-->';
                    }                    
                $output .= '</div>';
                $output .= $subheadline;            
        }
        
        $output .= '</header>';    
        return $output;
        
    }
}