Viewing 17 posts - 1 through 17 (of 17 total)
  • Author
    Posts
  • #1275140

    Hello

    Is there a way to change all H6 Tags in the product pages into “Paragraph” instead ?
    I have more than 500 Products, and initially, when we first designed the page, we made a mistake of writing the texts in H6 rather than in Paragraph.

    This is affecting SEO and we need to change the text format of all products into “Paragraph”. I am not talking about changing the CSS as this is to Google Search Engine not well optimized.

    I hope you can help !

    Thanks !

    #1275475

    Hey Mohamad,
    We could change the H6 to “p” with jQuery, this would change the tag in the DOM (on page load), Google will recognize this but some SEO tools that only check the source code might not recognize this. If you want to change the H6 in the source code you will have to manually change the tags.
    Please link to one of your product pages with the H6’s to change so I can examine the elements and write a script.

    Best regards,
    Mike

    #1275769

    Hello Mike
    Thank you for your message .. this is very clear !
    Here is an example of the product

    As you can notice in the Description section here https://per-vurt.com/product/pioneer-ddj-flx6-lebanon/#tab-id-2

    we have written texts in H6 !!! that was a mistake !

    #1275780

    that one line i marked with: // —- here

    is the line you had to edit – you can add more lines like this to replace other tags
    the script takes over all attributes of the original tag and transfers them to the new tag.
    But this is not necessary on your page.

    to your child-theme functions.php:

    function replace_tags_with_tags(){
    ?>
    <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('.tab_inner_content.invers-color h6', '<p></p>'); // ---- here
      }(jQuery)); 
    </script>
    <?php
    }
    add_action('wp_footer', 'replace_tags_with_tags');

    but for SEO purpose as mike said allready – maybe it is better to change it manually in the albs.

    #1275790

    Hi,
    Thank you for the link, try adding this code to the end of your functions.php file in Appearance > Editor:

    function custom_h6_tabcontainer_script() { ?>
        <script>
    (function($) {
      $(document).ready(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('#top.single-product .tabcontainer.sidebar_tab_left .tab_inner_content > h6', '<p></p>');
      });
    }(jQuery));
    </script>
        <?php
    }
    add_action('wp_footer', 'custom_h6_tabcontainer_script');

    This should only work if your single products have a tab container with a left sidebar and the inner container has an H6, this should be specific enough to not conflict with any other H6’s on your site, but please clear your browser cache and check.

    Best regards,
    Mike

    #1275820

    Hello @Guenni007 and Hello again @Mike

    I tried this code (Mike’s) and it worked / thank you
    But is this still something that can go well with SEO ? or will it still see it as H6 ? I think we are good to go now ?!

    ON another note, i can see that there is an error in the font
    https://snipboard.io/hfinv8.jpg

    Not sure if this is a result of the code, i doubt, but do you know how i can solve this font issue, as it is also making my page load slower according to GTMetrix

    Thanks

    #1276061

    Hi,
    For the font 404 errors, it looks like this code is added to your header: @font-face { font-family:helveticabold;src:;font-display: swap;}
    are you using the theme version of helvetica or are you adding it in your css or functions.php?
    As for the H6 & SEO, Google does recognize the change in the DOM to the tags, so this would work. Making the change manually would be best, but since it is on 500+ products, making the change with jQuery is what I would recommend.

    Best regards,
    Mike

    *It looks like Guenni007 and I were posting the same code at the same time 😂, thanks to Guenni007 for this code posted a while back 👍

    #1276095

    Hello Mike

    “making the change with jQuery is what I would recommend. ” so this is exactly what i just did (copying your code in the function.php right) ?

    Concerning the font, i am not really sure ! How can i know ?

    #1276281

    Hi,
    Yes, correct, this is what you did.
    For the font, please include an admin login in the Private Content area so we can take a look.

    Best regards,
    Mike

    #1276454

    Thank you !

    #1276530

    Hi,
    Thank you for the login, I removed this from your Quick CSS to solve the error:

    @font-face {
     font-family: 'helvetica';
     src: url('helvetica.eot'); /* IE9 Compat Modes */
     src: url('helvetica.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
       url('helvetica.woff') format('woff'), /* Modern Browsers */
       url('helvetica.ttf')  format('truetype'), /* Safari, Android, iOS */
       url('helvetica.svg#svgFontName') format('svg'); /* Legacy iOS */
    }

    Please clear your browser cache and check.

    Best regards,
    Mike

    #1276535

    Hi Mike

    Thank you so much
    The problem is that many texts have changed style after we have removed this code !

    I brought it back again now !

    Do you know how can i keep using it and at the same time not have the error ? and is this error really slowing my site a lot ? or do you think that removing this code will make a big difference on the page load speed ?

    Thank you !

    #1276552

    Hi,
    Can you explain which texts is dependent on this css, are they related to your custom font plugin?
    I believe that your past dev installed this plugin and assigned “helveticabold” as a font, but there is no font file uploaded in the options of the plugin. I think the combination of the css and the mis defined font is the issue.
    I would try uploading the correct “helveticabold” font in the plugin options and remove the css to fix this.
    If that didn’t work I would disable the plugin & css & then upload the “helveticabold” font in the Enfold Theme Options > Import/Export > Custom Font Manager

    Best regards,
    Mike

    #1276605

    Hello @Mike
    Thank you for your endless support

    I have solved the issue after going through a lot of problems !
    – I have edited the main “Additional CSS” codes and removed “helveticabold” as this was a missing font .. I also removed “helvetica” and “arial” .. i only kept “helvetica neue” and “sans-serif”
    – I have also deleted the plugin Custom Fonts since i will not be in use of it anymore
    – I have kept the CSS code you have mentioned

    Thank you !

    #1276619

    Hi,
    Glad to hear you were able to sort this out🙂
    Since that and the product H tags are sorted out, shall we close this then?

    Best regards,
    Mike

    #1276765

    Hello Mike
    Yes thank you :)

    #1276802

    Hi,
    Glad we were able to help, we will close this now. Thank you for using Enfold.

    For your information, you can take a look at Enfold documentation here
    For any other questions or issues, feel free to start new threads in the Enfold forum and we will gladly try to help you :)

    Best regards,
    Mike

Viewing 17 posts - 1 through 17 (of 17 total)
  • The topic ‘Help with Product H-Tags’ is closed to new replies.