[Resolved] Stray end tag

Home Forums Support Stray end tag

Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • #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?

    #965167
    Leo
    Staff
    Customer Support

    Hi 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?

    #965303
    Hans

    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.

    #965387
    Leo
    Staff
    Customer Support

    Not 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?

    #965826
    Hans

    Yes, I use 20 elements and many of them are hooks. Excerpt of Elements page

    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?

    #966179
    Tom
    Lead Developer
    Lead Developer

    The 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.

    #966862
    Hans

    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.

    #967168
    Tom
    Lead Developer
    Lead Developer

    Can you share the content of the problem hook?

    #967216
    Hans

    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.

    #967505
    Tom
    Lead Developer
    Lead Developer

    So 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.

    #967615
    Hans

    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.

    #968026
    Tom
    Lead Developer
    Lead Developer

    wp_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.

    #968073
    Hans

    This issue is also solved by your routine concerning the rotating background.

    Thanks

    #968215
    Tom
    Lead Developer
    Lead Developer
Viewing 14 posts - 1 through 14 (of 14 total)
  • You must be logged in to reply to this topic.