Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1420064

    ahurlburt53
    Participant

    I just want to have the title of page or post to have just one h1 tag not multiple. This is a huge factor that is hurting us for SEO. Please advise on how to fix. For example I have 42 clients and all web pages are showing multiple h1 tags.

    Also blog tags and categories are showing as h1 tags. This is not good for SEO. Can we make them h2 tags instead

    the is one example web page https://www.liz-law.com/charitable-organization/ click on view page source and look for <h1. You will see that here are 3 h1 tags

    screen shot

    View post on imgur.com

    #1420102

    Thai
    Moderator

    Hi There,

    #1] Please navigate to your child theme’s /framework/views/renew directory create a file named _landmark-header.php and paste the code below:

    <?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() ) : ?>
    
                <h1 class="h-landmark"><span><?php echo x_get_option( 'x_renew_shop_title' ); ?></span></h1>
    
              <?php elseif ( x_is_bbpress() ) : ?>
    
                <h1 class="h-landmark"><span><?php echo get_the_title(); ?></span></h1>
    
              <?php elseif ( x_is_buddypress() ) : ?>
                <?php if ( x_buddypress_is_component_with_landmark_header() ) : ?>
    
                  <h1 class="h-landmark"><span><?php echo x_buddypress_get_the_title(); ?></span></h1>
    
                <?php endif; ?>
              <?php elseif ( is_page() ) : ?>
    
                <h1 class="h-landmark entry-title"><span><?php the_title(); ?></span></h1>
    
              <?php elseif ( is_home() || is_single() ) : ?>
                <?php if ( x_is_portfolio_item() ) : ?>
    
                  <h1 class="h-landmark"><span><?php echo x_get_parent_portfolio_title(); ?></span></h1>
    
                <?php else : ?>
    
                  <h2 class="h-landmark"><span><?php echo x_get_option( 'x_renew_blog_title' ); ?></span></h2>
    
                <?php endif; ?>
              <?php elseif ( is_search() ) : ?>
    
                <h1 class="h-landmark"><span><?php _e( 'Search Results', '__x__' ); ?></span></h1>
    
              <?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__' );
    
                ?>
    
                <h1 class="h-landmark"><span><?php echo $title; ?></span></h1>
    
              <?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__' );
    
                ?>
    
                <h1 class="h-landmark"><span><?php echo $title ?></span></h1>
    
              <?php elseif ( is_404() ) : ?>
    
                <h1 class="h-landmark"><span><?php _e( 'Oops!', '__x__' ); ?></span></h1>
    
              <?php elseif ( is_year() ) : ?>
    
                <h1 class="h-landmark"><span><?php _e( 'Post Archive by Year', '__x__' ); ?></span></h1>
    
              <?php elseif ( is_month() ) : ?>
    
                <h1 class="h-landmark"><span><?php _e( 'Post Archive by Month', '__x__' ); ?></span></h1>
    
              <?php elseif ( is_day() ) : ?>
    
                <h1 class="h-landmark"><span><?php _e( 'Post Archive by Day', '__x__' ); ?></span></h1>
    
              <?php elseif ( x_is_portfolio() ) : ?>
    
                <h1 class="h-landmark"><span><?php the_title(); ?></span></h1>
    
              <?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; ?>

    #2] Please navigate to your child theme’s /framework/views/global directory create a file named _brand.php and paste the code below:

    <?php
    
    // =============================================================================
    // VIEWS/GLOBAL/_BRAND.PHP
    // -----------------------------------------------------------------------------
    // Outputs the brand.
    // =============================================================================
    
    $site_name        = get_bloginfo( 'name' );
    $site_description = get_bloginfo( 'description' );
    $logo             = x_make_protocol_relative( x_get_option( 'x_logo' ) );
    $site_logo        = '<img src="' . $logo . '" alt="' . $site_description . '">';
    
    ?>
    
    <a href="<?php echo home_url( '/' ); ?>" class="<?php x_brand_class(); ?>" title="<?php echo $site_description; ?>">
      <?php echo ( $logo == '' ) ? $site_name : $site_logo; ?>
    </a>

    Hope it helps 🙂

    #1420118

    ahurlburt53
    Participant

    Thank you for your fast response, please help me understand what this code will do exactly

    #1420136

    Thai
    Moderator

    Hi There,

    For #1]: I change the h1 tag to h2 tag only on single post.

    For #2]: I removed the h1 tag next to the logo.

    Regards!