Change Blog Post Title to H2

Hello. Currently, the title of my blog posts appears in H1. I’d like to change that to H2.

Here’s a sample page.

Can someone help me out with the CSS code?

Thanks!

Hi there,

This is not possible with CSS. You will have to override the theme using a child theme.

Then create the file _content-post-header.php in /wp-content/themes/x-child/framework/views/ethos/ and add this code:

<?php

// =============================================================================
// VIEWS/ETHOS/_CONTENT-POST-HEADER.PHP
// -----------------------------------------------------------------------------
// Standard <header> output for various posts.
// =============================================================================

?>

<header class="entry-header">
  <?php if ( is_single() ) : ?>
    <?php x_entry_navigation(); ?>
    <h2 class="entry-title"><?php the_title(); ?></h2>
  <?php else : ?>
    <h2 class="entry-title">
      <a href="<?php the_permalink(); ?>" title="<?php echo esc_attr( sprintf( __( 'Permalink to: "%s"', '__x__' ), the_title_attribute( 'echo=0' ) ) ); ?>"><?php x_the_alternate_title(); ?></a>
    </h2>
  <?php endif; ?>
  <?php x_ethos_entry_meta(); ?>
</header>

Hope this helps.

1 Like

Hi there…thanks so much for answering. That’s totally over my head. I’ll make do with the theme as it is.

all the best,
Jesamine

No worries, Jesamine.

Cheers!

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.