- This topic has 13 replies, 3 voices, and was last updated 6 years, 1 month ago by
Tom.
-
AuthorPosts
-
July 23, 2019 at 12:26 am #964737
Hans
I am searching an error in my site. In the admin area I loose the top bar on some pages. When I refresh the page everything is okay.
Investigating the error I found this message concerning the </head> tag: Stay end tag. And this is an excerpt of the code:
<script> function sw_weiter() { var msel = document.getElementById("selstr"); str = msel.options[selstr.selectedIndex].value; var thtml = '<h3 class="gruen">' + str + '</h3>'; thtml += '<strong>Hausnummer</strong><br>'; thtml += '<input autocomplete="off" class="weit15" type="text" id="hausnr" name="hausnr" oninput="n_testHausnr()" onfocus="moveCursorToEnd(this)" onclick="moveCursorToEnd(this)" value="">'; thtml += ' <button onclick="sw_reset()">Neu</button>'; thtml += '<input type="hidden" id="strasse" value="' + str + '">'; document.getElementById("result_st").innerHTML = thtml; window.hausnr.focus(); return; } </script><link rel="icon" href="http://waehlt.spd-simmerath.de/wp-content/uploads/2019/03/favicon.gif" sizes="32x32" /> <link rel="icon" href="http://waehlt.spd-simmerath.de/wp-content/uploads/2019/03/favicon.gif" sizes="192x192" /> <link rel="apple-touch-icon-precomposed" href="http://waehlt.spd-simmerath.de/wp-content/uploads/2019/03/favicon.gif" /> <meta name="msapplication-TileImage" content="http://waehlt.spd-simmerath.de/wp-content/uploads/2019/03/favicon.gif" /> </head> <body class="post-template-default single single-post postid-38 single-format-standard wp-embed-responsive post-image-above-header post-image-aligned-center secondary-nav-above-header secondary-nav-aligned-right right-sidebar nav-above-header fluid-header separate-containers active-footer-widgets-0 nav-aligned-center header-aligned-center dropdown-hover" itemtype="https://schema.org/Blog" itemscope> <a class="screen-reader-text skip-link" href="#content" title="Springe zum Inhalt">Springe zum Inhalt</a> <nav id="site-navigation" class="main-navigation grid-container grid-parent" itemtype="https://schema.org/SiteNavigationElement" itemscope> <div class="inside-navigation grid-container grid-parent"> <button class="menu-toggle" aria-controls="primary-menu" aria-expanded="false">
Could this be the reason of loosing control?
July 23, 2019 at 8:39 am #965167Leo
StaffCustomer SupportHi there,
It could be – the code isn’t coming from GP though.
Have you tried disabling all plugins except GP Premium to identify where that’s coming from?
July 23, 2019 at 11:39 am #965303Hans
It’s strange. I deactivated all plugins except Simple CSS und GP Premium. On many pages Javascript is merged to the footer as defined in Elements. In some others Javasript is in the head. Then there is the error message “stray end tag” when I check the code and it seems to be the reason of the missing admin bar.
July 23, 2019 at 1:40 pm #965387Leo
StaffCustomer SupportNot sure if I fully understand.
So you think the problem is coming from GP?
Do you have any custom functions added in the child theme or hook elements?
July 24, 2019 at 4:49 am #965826Hans
Yes, I use 20 elements and many of them are hooks.
All Javascript functions are added to wp_footer. Nevertheless in some page they are injected tp wp_head. No other plugins besides Simmle CSS and GP Premium are activated.
On the pages without aminbar the following text is to be found:
<style type="text/css" media="print">#wpadminbar { display:none; }</style>
Who is generationg ths code? Might it be WordPress?
July 24, 2019 at 9:33 am #966179Tom
Lead DeveloperLead DeveloperThe Elements shouldn’t load in your admin area. What happens if you temporarily deactivate all of them? If the issue goes away, you’ll need to deactivate them one by one to find the problem hook. Then we can look at the code and see if we can spot the issue.
July 25, 2019 at 6:37 am #966862Hans
It seems to happen when I use HTML hook. This hook is using a Javascrippt function which must be added to wp_head. Otherwise some browsers don’t know this function.
July 25, 2019 at 9:41 am #967168Tom
Lead DeveloperLead DeveloperCan you share the content of the problem hook?
July 25, 2019 at 10:30 am #967216Hans
Hi Tom,
this is the HTML hook:
<div class="container"><div><div><div class="hellerbg"><div style="margin:10px !important;"><div style="float: left;"><a href="http://spd-simmerath.de" rel="home"><img class="spd-logo" src="http://swimages.spd-simmerath.de//2019/03/spd_logo_simmerath-200-1.png" onload="kandimg()"></a></div><div><button class="titel-butt" onclick="location.replace('http://waehlt.spd-simmerath.de/blog/')"><h1 class="swtitel">SIMMERATH</h1><span style="font-size: 28px; line-height: 30px; color: #e3000f">sozialer - gerechter - lebenswerter</span></button></div><p class="sw-description" itemprop="description">Information zur Kommunalwahl 2020</p></div></div><div id="kandbild"></div></div></div><div><div class="aligncenter hellerbg hellerbg1">[widget id="stbez_widget-3"]</div><div class="aligncenter hellerbg hellerbg1"><h2 style="color: #e3000f;"><strong>SPD Simmerath informiert</strong></h2><p style="text-align: justify;">Mit der Kommunalwahl 2020 werden in unserer Gemeinde entscheidende Weichen gestellt. Hier stellen wir Ihnen unser Programm und unsere Kandidaten vor.</p><h2 class="widgettitle">Letzte Meldungen</h2><div style="background-color: #c0c0c0; padding-top: 5px;">[aktuelles anz="3"]</div><h2 class="widgettitle">Anstehende Termine</h2><div style="background-color: #c0c0c0; padding-top: 5px;">[termine anz="3"]</div><button style="margin: 7px; padding: 7px" onclick="sw_button('blog/')">Meldungen</button><button style="margin: 7px; padding: 7px" onclick="sw_button('termine/')">Termine</button><button style="margin: 7px; padding: 7px" onclick="sw_button('wahlprogramme/')">Wahlprogramme</button></div></div></div><noscript> <h2 style="color: red">Leider haben Sie Javascript deaktiviert. Sie können diese Seite nur sehr eingeschränkt nutzen.</h2></noscript>
And this is the acript:
`<script>
function kandimg() {
var xhttp;
var bez = document.getElementById(“ktgbild”).src;
var slen = bez.length – 4;
bez = bez.substring(0,slen);
var pos = bez.lastIndexOf(“-“, slen);
bez = bez.substring(pos+1);
xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
document.getElementById(“kandbild”).innerHTML = this.responseText;
}
}
xhttp.open(“GET”, “http://waehlt.spd-simmerath.de/sw_kandbild.php?stbez=”+bez);
xhttp.send();
return;
}
</script>Hope this helps.
July 25, 2019 at 7:51 pm #967505Tom
Lead DeveloperLead DeveloperSo if you disable this specific Element, the issue in the admin goes away? I’m not seeing why it would affect the admin area, and I’m not seeing a stray end tag.
July 26, 2019 at 1:22 am #967615Hans
I have to investigate the issue more intensive. The last remark was only conneted to this problem:
The hook is using a Javascrippt function which must be added to wp_head. Otherwise some browsers don’t know this function.
July 26, 2019 at 10:00 am #968026Tom
Lead DeveloperLead Developerwp_head
only fires on the front-end of the website – it doesn’t exist in the admin area.You should be able to test it quite easily by disabling the hooks one by one – that should help you find the problem hook.
July 26, 2019 at 11:36 am #968073Hans
This issue is also solved by your routine concerning the rotating background.
Thanks
July 26, 2019 at 5:21 pm #968215Tom
Lead DeveloperLead DeveloperAwesome! 🙂
-
AuthorPosts
- You must be logged in to reply to this topic.