More than one H1 tag on post pages

Hello

In our news section all the posts have two H1 tags. The top H1 says “Nyheter” (=news) and is duplicatated across all the news items. The other H1 is the post title and is the correct H1 for the page.

Some examples:


I saw some other threads about duplicate H1 tags on the forum but when I checked our WP folders and files I didn’t see the same one as outlined in the thread. I’m not a developer and I have bad experience with “trial and error” when coding so I want to be sure that if I do any changes they are correct, and so I ask again. How can I remove the H1 tags around “Nyheter” in a safe way?

I already have a child theme installed.

Thank you in advance!

Hey Jan,

We could not promise safety here because you’ll be working with PHP code and making mistakes in PHP files could result in fatal errors which could take down your site. Please just keep that in mind.

The procedure to change the Header Landmark code of the Renew stack is this:

  1. Copy the _landmark-header.php file inside the parent theme’s /wp-content/themes/x/framework/legacy/cranium/headers/views/renew folder
  2. Create the same folder structure in your child theme like /wp-content/themes/x-child/framework/legacy/cranium/headers/views/renew. Make sure there are no typos here because this will not work.
  3. Paste the copied file to the newly created folder in your child theme.
  4. Modify the copied file. In the case of Renew Header Landmark, you’ll see the h1 tags like in the screenshot below:

Change h1 to h2. Be sure to change all h1 in there because introducing a syntax error in there could result in broken page layout. Change <h1 and </h1>.

If you wish to customize other theme templates, you can follow that similar procedure. For more details about theme customization, please see https://theme.co/apex/forum/t/customizations-best-practices/205

Hope that helps.

Hi Christian

Thank you for your reply. I managed to edit the _landmark-header.php file in the child theme without hurting any innocent websites. However, the “Nyheter” heading is still in h1. I changed the code as follows:

But I didn’t change any of the other H1 tags. Actually I wasn’t sure ehat you meant when you said

Did you mean to change every single h1 and /h1 pair in the whole file, or did you just stress the importance of changing both the h1 and /h1 on the line I was editing?

Hi Jan,

Yes, to change h1 and /h1 as a pair. Or all h1 as needed but always do it as pair to avoid errors.

I think what you need is to change all existence of h1 on that file to h2 tags. What you share is changing just the h1 tags of bbpress pages. What Christian share on the image is just a demonstration.

Hope this helps.

1 Like

Yes, to change h1 and /h1 as a pair. Or all h1 as needed but always do it as pair to avoid errors.

I think what you need is to change all existence of h1 on that file to h2 tags. What you share is changing just the h1 tags of bbpress pages. What Christian share on the image is just a demonstration.

Hope this helps.

Ok, I just erred on the side of caution with this one, and made less changes than necessary. Now I changed all the H1 pairs to H2 and it seems to be working. And the website didn’t even explode in a fireball!

Thank you both for your help!

Glad to hear it’s sorted, Jan. :slight_smile:

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