Duplicate H1 Titles on All Posts (No _brand.php in Parent Theme to Copy)

Hello xTheme.

I recently purchased the x Theme, installed the “Renew 8” Demo and initially was working with just the Parent Theme.

I added this code in the additional CSS to remove a Title called “The Blog” from all of my posts and articles:

“.blog header.x-header-landmark, .single-post header.x-header-landmark {
display: none;
}
.entry-title:before {
content:” " !important;
}
"

However, I noticed that the this was still appearing as a H1 Tag in the HTML.

I want to remove this from all my posts and pages.

So I installed a Child Theme to make the changes required. I’ve followed other support questions on how to copy across the “_brand.php” from the parent to the child theme but there is no “_brand.php” in the global directory?

I wondered why I couldn’t find this?

I also tried to create the _brand.php file in the child theme from scratch but this code does not work _ i just see the code at the top of my website.

Could you please assist,

Thanks a lot in advance,

Hey Jeremy,

_brand.php could be found in x\framework\legacy\cranium\headers\views\global. You can override it by following our customization guide: https://theme.co/apex/forum/t/customizations-best-practices/205

Hope that helps.

Thanks Christian,

I’ve managed to find the _brand.php file, and have gone to your customization guide.

I’m still completely unsure how to remove the “The Blog” H1 Tag from all of my articles and pages.

As i understand I need to copy the brand.php file over to the child theme. I’ve done that but am not sure what I need to edit in there.

Also is it just the _brand.php file i need to move over or the 4 other files (_header.php, _navbar.php etc)

Heres my brand.php file:

<?php

// =============================================================================
// VIEWS/GLOBAL/_BRAND.PHP
// -----------------------------------------------------------------------------
// Outputs the brand.
// =============================================================================

$option_logo_text = x_get_option( 'x_logo_text' );
$option_logo_src  = x_get_option( 'x_logo' );
$logo_text        = ( empty( $option_logo_text ) ) ? get_bloginfo( 'name' ) : $option_logo_text;

if ( empty( $option_logo_src ) ) {
  $logo_output = $logo_text;
} else {
  $logo_src    = x_make_protocol_relative( $option_logo_src );
  $logo_output = '<img src="' . $logo_src . '" alt="' . $logo_text . '">';
}

if ( x_get_option( 'x_logo_visually_hidden_h1' ) ) {
  echo '<h1 class="visually-hidden">' . $logo_text . '</h1>';
}

?>

<a href="<?php echo home_url( '/' ); ?>" class="<?php x_brand_class(); ?>">
  <?php echo $logo_output; ?>
</a>

Thanks in advance,

Sorry if I assumed you already know how to do customizations.

You will need to change the h1 tag in that file. Here’s a similar thread: https://theme.co/apex/forum/t/more-than-one-h1-tag-remove-h1-added-by-x-theme-to-each-page/10608/16?u=christian_y

I also focused on the _brand.php file so I forgot to say that “The Blog” is displayed by the _landmark-header.php which is located in x\framework\legacy\cranium\headers\views\STACK. For more details, you might want to read this thread: https://theme.co/apex/forum/t/css-errors/29711/20?u=christian_y

Thanks.

Hello Christian,

Thank you for your responses.

I have followed both posts, and still am receiving the “The Blog” H1 on only some of my articles.

So here is what I have done:

  1. Replicated the folder path so the files are in the same places (on both the X and Child X Themes)
  2. Copied across the _brand.php and swapped out the h1s to “ps” following the article you linked to
  3. Copied across the landmark-header.php from the parent theme to the child theme through this path “public_html/unrivaledreview.com/wp-content/themes/x/framework/legacy/cranium/headers/views/renew”
  4. Changed the h1 tags in under the <?php elseif ( is_home() || is_single() ) : ?> condition to “p” instead of h1. So here is how it looks:

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

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

        <?php else : ?>

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

So it seems to have worked for some of my articles, particularly the new ones.

But some of my older articles still have “The Blog” as H1 titles.

How do I remove this from the entire site?

Do i need to change any other instances of “h1” in the landmark file?

Thanks

Hi There,

I’ve changed all the h1 tags to h2. You just need to copy this code to your landmark-header.php 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; ?>

Regards!

Thank you Thai!

Seems to have worked!

Are there any repercussions of moving this to a H2?

Hi Jeremy,

Glad it’s working now.

It should be okay since H1 is already present, unless you’ll remove that one as well.

Thanks!

There would be no repercussions, Jeremy. But, since you’ve overriden a template file, you will need to watch out for future changes in the template because there might be breaking changes in the future. In that event, you will need to repeat the steps we showed you here.

Thanks.

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