Remove Double H1 Tag in Blog Posts

Hello I need to remove the doubleH1 tag for blog posts by removing

Blog

I have followed the thread and solution at https://theme.co/apex/forum/t/remove-double-h1-tag-on-single-post-blog-pages/13139 but it does not solve my issue.

I am using the Renew stack with the X theme (not pro) I have double checked the code and uploaded this file to the child theme’s folder wp-content/theme/x-child/framework/legacy/cranium/views/headers/renew/ as you suggested in that other thread, but it does not remove the remove the doubleH1 tag for blog posts when you look at the page source code.

Of course this is an issue for SEO.

Can you please assist?

1 Like

Hello There,

Thanks for writing in! To resolve your issue, since you have your child theme active and ready, please follow the following steps below:
1] Using Notepad or TextEdit or Sublime Text or any text editor, please create a new file in your local machine.
2] Insert the following code into that new file

<?php

// =============================================================================
// VIEWS/RENEW/_LANDMARK-HEADER.PHP
// -----------------------------------------------------------------------------
// Handles content output of large headers for key pages such as the blog or
// search results.
// =============================================================================

$disable_page_title = get_post_meta( get_the_ID(), '_x_entry_disable_page_title', true );
$breadcrumbs        = x_get_option( 'x_breadcrumb_display' );

?>

<?php if ( ! x_is_blank( 1 ) && ! x_is_blank( 2 ) && ! x_is_blank( 4 ) && ! x_is_blank( 5 ) ) : ?>
  <?php if ( is_page() && $disable_page_title == 'on' ) : ?>

  <?php else : ?>

    <header class="x-header-landmark">
      <div class="x-container max width">
        <div class="x-landmark-breadcrumbs-wrap">
          <div class="x-landmark">

          <?php if ( x_is_shop() || x_is_product() ) : ?>

            <h2 class="h-landmark"><span><?php echo x_get_option( 'x_renew_shop_title' ); ?></span></h2>

          <?php elseif ( x_is_bbpress() ) : ?>

            <h2 class="h-landmark"><span><?php echo get_the_title(); ?></span></h2>

          <?php elseif ( x_is_buddypress() ) : ?>
            <?php if ( x_buddypress_is_component_with_landmark_header() ) : ?>

              <h2 class="h-landmark"><span><?php echo x_buddypress_get_the_title(); ?></span></h2>

            <?php endif; ?>
          <?php elseif ( is_page() ) : ?>

            <h2 class="h-landmark entry-title"><span><?php the_title(); ?></span></h2>

          <?php elseif ( is_home() || is_single() ) : ?>
            <?php if ( x_is_portfolio_item() ) : ?>

              <h2 class="h-landmark"><span><?php echo x_get_parent_portfolio_title(); ?></span></h2>

            <?php else : ?>

              <h2 class="h-landmark"><span><?php echo x_get_option( 'x_renew_blog_title' ); ?></span></h2>

            <?php endif; ?>
          <?php elseif ( is_search() ) : ?>

            <h2 class="h-landmark"><span><?php _e( 'Search Results', '__x__' ); ?></span></h2>

          <?php elseif ( is_category() || x_is_portfolio_category() || x_is_product_category() ) : ?>

            <?php

            $meta  = x_get_taxonomy_meta();
            $title = ( $meta['archive-title'] != '' ) ? $meta['archive-title'] : __( 'Category Archive', '__x__' );

            ?>

            <h2 class="h-landmark"><span><?php echo $title; ?></span></h2>

          <?php elseif ( is_tag() || x_is_portfolio_tag() || x_is_product_tag() ) : ?>

            <?php

            $meta  = x_get_taxonomy_meta();
            $title = ( $meta['archive-title'] != '' ) ? $meta['archive-title'] : __( 'Tag Archive', '__x__' );

            ?>

            <h2 class="h-landmark"><span><?php echo $title ?></span></h2>

          <?php elseif ( is_404() ) : ?>

            <h2 class="h-landmark"><span><?php _e( 'Oops!', '__x__' ); ?></span></h2>

          <?php elseif ( is_year() ) : ?>

            <h2 class="h-landmark"><span><?php _e( 'Post Archive by Year', '__x__' ); ?></span></h2>

          <?php elseif ( is_month() ) : ?>

            <h2 class="h-landmark"><span><?php _e( 'Post Archive by Month', '__x__' ); ?></span></h2>

          <?php elseif ( is_day() ) : ?>

            <h2 class="h-landmark"><span><?php _e( 'Post Archive by Day', '__x__' ); ?></span></h2>

          <?php elseif ( x_is_portfolio() ) : ?>

            <h2 class="h-landmark"><span><?php the_title(); ?></span></h2>

          <?php endif; ?>

          </div>

          <?php if ( $breadcrumbs == '1' ) : ?>
            <?php if ( ! is_front_page() && ! x_is_portfolio() ) : ?>
              <div class="x-breadcrumbs-wrap">
                <?php x_breadcrumbs(); ?>
              </div>
            <?php endif; ?>
          <?php endif; ?>

          <?php if ( x_is_portfolio() ) : ?>
            <div class="x-breadcrumbs-wrap">
              <?php x_portfolio_filters(); ?>
            </div>
          <?php endif; ?>

        </div>
      </div>
    </header>

  <?php endif; ?>
<?php endif; ?>

3] Save the file named as _landmark-header.php
4] Upload this file to your server in the child theme’s folder wp-content/themes/x-child/framework/legacy/cranium/headers/views/renew/

You will have to create the folder path since it does not exist yet in your child theme.

Please let us know how it goes.

Thanks the new directory worked!

Is there anyway to keep the H1s on the main category pages, but not on the blog? I will send you a link example in a private page.

Hi There,

As you can see in the code above, we change all the headline tag to <h2> if you want the pages to retain the <h1>, please look for this block:

<?php elseif ( is_page() ) : ?>

            <h2 class="h-landmark entry-title"><span><?php the_title(); ?></span></h2>

And change the <h2> </h2> back to <h1> </h1>

Thanks,

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