post_type === 'page' ) { $title = $page_for_posts->post_title; } else { $title = __( 'Latest Posts', 'blockify' ); } $content = str_replace( $text, $title, $content ); } $padding = $block['attrs']['style']['spacing']['padding'] ?? null; if ( $padding ) { $styles = []; foreach ( $padding as $key => $value ) { $styles[ 'padding-' . $key ] = $value; } $dom = dom( $content ); // No way of knowing tag. $heading = get_dom_element( 'h1', $dom ) ?? get_dom_element( 'h2', $dom ) ?? get_dom_element( 'h3', $dom ) ?? get_dom_element( 'h4', $dom ) ?? get_dom_element( 'h5', $dom ) ?? get_dom_element( 'h6', $dom ); $class = $heading->getAttribute( 'class' ); if ( ! $class ) { return $content; } $heading->setAttribute( 'style', css_array_to_string( $styles ) . ';' . $heading->getAttribute( 'style' ) ); $content = $dom->saveHTML(); } return $content; }