
-
AuthorPosts
-
January 3, 2020 at 6:46 pm #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 advanceJanuary 4, 2020 at 11:18 pm #1170375Hey 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,
MikeJanuary 5, 2020 at 2:33 pm #1170441Doesn´t work. I have still the h3 headings.
January 5, 2020 at 4:26 pm #1170460Hi,
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,
MikeJanuary 5, 2020 at 4:50 pm #1170466I 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.January 5, 2020 at 5:10 pm #1170469Hi,
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 forCookie- und Datenschutzeinstellungen
there you will see the H3 is now a span:
that was the one we are working on correct?Best regards,
MikeJanuary 5, 2020 at 5:18 pm #1170471I purged all caches and still have the error:
<h3 class=’av-special-heading-tag ‘ itemprop=”headline” >Cookie- und Datenschutzeinstellungen</h3>
January 5, 2020 at 5:32 pm #1170473Hi,
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,
MikeJanuary 5, 2020 at 5:51 pm #1170476The 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.January 5, 2020 at 6:31 pm #1170481Hi,
Actually your issue seems to be your Total Cache minify setting, when it is on you get thegagTracker is not defined
error and your homepage slider doesn’t show.
But when the minify is off you get thejQuery is not defined
error because your Enfold Theme Options > Performance > Load jQuery into your footer setting is on:
So first you need to have the “Load jQuery into your footer” off and you need to disable your Total Cache minify.Best regards,
MikeJanuary 5, 2020 at 6:39 pm #1170482Hi,
Ok, I switched off “Load jQuery into your footer” and completely disabled the W3 total cache plugin: no changes, still h3.
January 5, 2020 at 6:43 pm #1170483January 5, 2020 at 6:50 pm #1170485This 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.January 5, 2020 at 7:06 pm #1170492Ok, 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?January 5, 2020 at 7:24 pm #1170502Hi,
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,
MikeJanuary 6, 2020 at 10:36 am #1170649Hi 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
MarcelJanuary 6, 2020 at 11:33 am #1170660Hi,
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 -
AuthorPosts
- The topic ‘remove h3 heading from cookie display message’ is closed to new replies.