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

    Hi,
    in my Enfold theme, there is a
    <h3 class='av-special-heading-tag ' itemprop="headline" >Cookie- und Datenschutzeinstellungen</h3>
    in the source code, even if the cookie message is hidden.
    I would like to replace the h3 with a span.
    Thanks in advance

    #1170375

    Hey megamazl,
    Try adding this code to the end of your functions.php file in Appearance > Editor:

    function custom_consent_tag_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('#av-consent-extra-info h3.av-special-heading-tag', '<span></span>');
      });
    }(jQuery)); 
    </script>
    <?php
    }
    add_action('wp_footer', 'custom_consent_tag_script');

    and add this code in the General Styling > Quick CSS field:

    #av-consent-extra-info span.av-special-heading-tag {
    	font-size: 20px;
    	font-weight: 300;
    }

    Then clear your browser cache and any cache plugin, and check.

    Best regards,
    Mike

    #1170441

    Doesn´t work. I have still the h3 headings.

    #1170460

    Hi,
    Today you are getting a couple of javascript errors for your gtag script in your cache/minify plugin,
    so there is either an error in the gtag script or multiple minifying broke it, or a quote was changed into a curly quote from the code I posted above when you pasted it into your functions.php
    Please include an admin login in the Private Content area so we can examine.

    Best regards,
    Mike

    #1170466

    I fixed the issues with my js. No gtag errors any more. Had some trouble with the HTTP headers and minify.
    The cookie h3 heading issue still exists.

    #1170469

    Hi,
    Thanks for correcting the javascript error, now the script is working correctly, I didn’t need to login or make changes, please clear your browser cache and search your source code for Cookie- und Datenschutzeinstellungen there you will see the H3 is now a span:
    2020-01-05-100504
    that was the one we are working on correct?

    Best regards,
    Mike

    #1170471

    I purged all caches and still have the error:

    <h3 class=’av-special-heading-tag ‘ itemprop=”headline” >Cookie- und Datenschutzeinstellungen</h3>

    #1170473

    Hi,
    Your javascript error has returned, please check.
    When I last check the error was resolved and the h3 tag had been changed to a span, as in my screenshot.

    Best regards,
    Mike

    #1170476

    The gtag error depends on your “do not track settings” in your browser. If the “do not track” is switched off, there is no error. If it is switched on, there is an error (which is maybe correct, I think).
    But in both cases, I still have h3 headings. I tried it with Opera, Firefox and Chrome with “do not track” on and off.

    #1170481

    Hi,
    Actually your issue seems to be your Total Cache minify setting, when it is on you get the gagTracker is not defined error and your homepage slider doesn’t show.
    2020-01-05-112401
    But when the minify is off you get the jQuery is not defined error because your Enfold Theme Options > Performance > Load jQuery into your footer setting is on:
    2020-01-05-112724
    So first you need to have the “Load jQuery into your footer” off and you need to disable your Total Cache minify.

    Best regards,
    Mike

    #1170482

    Hi,

    Ok, I switched off “Load jQuery into your footer” and completely disabled the W3 total cache plugin: no changes, still h3.

    #1170483

    Hi,
    Thanks, but I’m seeing “span” now
    2020-01-05-114216

    Best regards,
    Mike

    #1170485

    This is really strange. I checked it with three different browsers, also with a SEO check tool: https://www.seoreviewtools.com/html-headings-checker/
    Everywhere, there is a h3. Maybe, you can tell me, in which file this is defined, so I can change it by hardcode.

    #1170492

    Ok, I think, I got it.
    I guess, you opened the cookie settings dialogue by clicking on the settings button at the bottom of the page and THEN made a right click and used the browsers inspector to view the elements specifications. In this case, it is a span.
    But I just loaded the whole site and open the source code and searched for “cookie- “.
    So, your code is executed AFTER clicking the button. But a bot would still see the h3.
    Am I right?

    #1170502

    Hi,
    Oh, I just figured it out, I’m looking in the developers tools of the browser (F12) which is showing the page after the DOM has been executed and your looking at the page source code before the DOM has been executed. Sorry for the big run around.
    Anyways this is fine because Googlebot uses the rendered HTML to index the page, meaning that the screenshots that I was posting is what Google is indexing.

    Best regards,
    Mike

    #1170649

    Hi MIke,
    ok, perfect. Thanks and also thanks for the information how the bot is rendering the page. This was new for me.
    Now, everything is fine.

    best
    Marcel

    #1170660

    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 ‘remove h3 heading from cookie display message’ is closed to new replies.