Tagged: multiple H1
-
AuthorPosts
-
June 16, 2024 at 3:40 pm #1451383
Good morning,
on my portfolio page, I find 3 H1 tags which penalize SEO
, how can I fix this problem without affecting the rest of the site?
thank you for your comeback
June 16, 2024 at 7:49 pm #1451396Hey YMen45,
Thank you for the link to your site, the title bar h1.main-title is the correct h1 for the page, but I see that you manually added two more on the page

use the following code at the end of your child theme functions.php file in Appearance ▸ Editor to change the correct one to a “p” tag, and then you can change the two manually added ones to use just one H1 tag.function custom_script() { ?> <script> (function($) { function replaceElementTag(targetSelector, newTagString) { $(targetSelector).each(function(){ var newElem = $(newTagString, {html: $(this).html()}); $.each(this.attributes, function() { newElem.attr(this.name, this.value); }); $(this).replaceWith(newElem); }); } replaceElementTag('.page-id-4783 h1.main-title.entry-title', '<p></p>'); }(jQuery)); </script> <?php } add_action( 'wp_footer', 'custom_script', 99 );Please ensure to copy the code from the forum and not an email notification so the symbols are not converted.
Best regards,
MikeJune 17, 2024 at 8:08 am #1451610This reply has been marked as private.June 17, 2024 at 11:28 am #1451618Hi,
The use this to make “Portfolio” h2function custom_script() { ?> <script> (function($) { function replaceElementTag(targetSelector, newTagString) { $(targetSelector).each(function(){ var newElem = $(newTagString, {html: $(this).html()}); $.each(this.attributes, function() { newElem.attr(this.name, this.value); }); $(this).replaceWith(newElem); }); } replaceElementTag('.page-id-4783 h1.main-title.entry-title', '<h2></h2>'); }(jQuery)); </script> <?php } add_action( 'wp_footer', 'custom_script', 99 );and manually change “NOS REALISATIONS EN CREATION DE SITES INTERNET” as h1
“Découvrez notre portfolio” is h2
as they look to be in a text element that you manually added.Best regards,
MikeJune 17, 2024 at 11:44 am #1451620This reply has been marked as private.June 17, 2024 at 12:04 pm #1451624Hi,
Glad we were able to help, if you have any further questions please create a new thread and we will gladly try to help you. Thank you for using Enfold.Best regards,
Mike -
AuthorPosts
- The topic ‘triple H1 on a page where there is only the portfolio (except header and footer)’ is closed to new replies.
