Two h1's on Blog Posts - Blog Title and Post Title are Both h1

Hello,
I don’t want to have 2 h1’s on my blog posts.
I don’t want to get rid of the top “.x-landmark”, but I want my Post Titles to be my only h1.

Is there a way to make the Blog Title (.h-landmark) a div instead of an h1?

I do have a child theme set up if there’s PHP I can pop in.

Thank you!

Hi There,

Thanks for writing in! I have checked the site URL in your themeco account. Basically the Blog title is using H1 and the post titles are using H2 tags. Could you please provide us with the a link to your Blog page.

Thanks!

Yes, on that post, you are correct, it set the Post Title as H2 - but even so, it shouldn’t be. The Post Title (entry-title) should be the H1, not the name of the blog (h-landmark).

I don’t want to have 50 blog posts all with the same H1. The Post Title should be the H1, not the name of the blog.

For proper HTML structure, the only page that should have the name of the blog as the H1 should be the main Blog Index page at .com/blog/

So, Is there a way to make the Blog Title (.h-landmark) a div instead of an h1?

Hi @a_buzon

You will have to copy this file form the parent theme at:
/x/framework/legacy/cranium/headers/views/renew/_landmark-header.php
to this directory in the child theme:
/x-child/framework/views/renew/_landmark-header.php

Then modify every <h1></h1> element there, make sure to keep the class, I mean your new div should be like this <div class="h-landmark"></div>.

Thanks.

Hi @Alaa,
Thanks for the tip. I just did that but it doesn’t seem to be working.

Not sure if it makes a difference, but I did not have a “/renew” folder in my “/views” folder, so the PHP file is placed directly in my Views folder.

I cleared my browser cache, but if for some reason it does start working, won’t this get rid of the only H1 on my Blog Index Page also?

I’m terrible with PHP so I couldn’t tell which line was telling it to use an h1 h-landmark on the Index as opposed to Posts.

Hi there,

I understand, please create the renew folder if it doesn’t exist, you’ll have to follow the folder structure for it to work.

This is the line for both blog index and post

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

If you wish to apply a different title for blog index and post page then change that line to this

<?php if( is_home() ) : ?>
<h1 class="h-landmark"><span><?php echo x_get_option( 'x_renew_blog_title' ); ?></span></h1>
<?php else : ?>
<h1 class="h-landmark"><span>SINGLE POST TITLE</span></h1>
<?php endif; ?>

Thanks!

Thank you @Rad!

Question - Would doing this make the h-landmark on Posts be the Post title? Overwriting the name of a blog?

I’d still like the name of the blog to appear at the top of the page, I just don’t want that to be my H1 - maybe a div or a p; the one and only H1 should be the Post Title.

If I have to get rid of my .h-landmark / Blog Name to do this, I guess I will, but I would think this would be standard practice. The Post Title should always be the H1 on a Post.

In that case, you may update the landmark code into this:

<?php if( is_home() ) : ?>
<h1 class="h-landmark"><span><?php echo x_get_option( 'x_renew_blog_title' ); ?></span></h1>
<?php else : ?>
<h2 class="h-landmark"><span><?php echo x_get_option( 'x_renew_blog_title' ); ?></span></h2>
<?php endif; ?>

The blog title will be h1 in the blog index and it will have h2 tag in single posts and make the Post title only the h1 on the page.

Hope this helps.

Thank you @RueNel.
Now, do I just add this into my functions.php?
Or do I need to find this line in the " _landmark-header.php", change it to that, and add it to this directory in the child theme:
/x-child/framework/views/renew/_landmark-header.php?

Here’s all that landmark-header.php has that’s similar. It’s the only section containing “is_home” and only one to mention “blog”.

          <?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 : ?>

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

        <?php endif; ?>

Not sure what lines I would be replacing here (given it does go here and not in functions.php).
This starts at line 43.
Any additional instructions would be appreciated.

HI,

You can change this line

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

to

 <?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 elseif(is_singular('post')): ?>
             <h2class="h-landmark"><span><?php echo x_get_option( 'x_renew_blog_title' ); ?></span></h2>
        <?php else : ?>

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

        <?php endif; ?>

Hope that helps.

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