• Hello,

    This might be a little complicated to explain. I am trying to add a new piece of HTML/script over the featured-content/ featured-image, in the right hand corner, so that it displays a Windguru Live icon/box with live data (wind speed).

    I have created a child theme to make the modifications.

    Where & how would I make the changes in the child theme, to get the ‘Windguru Live’ icon to appear on the homepage, overlaying the featured-images?

    The widget code to create the small box is as follows (and works), and can been seen here https://mksc.org.uk/weather/live-weather ;

    <script id=”wglive_1271_1525727769720″>
    (function (window, document) {
    var loader = function () {
    var arg = [“spot=1271″,”uid=wglive_1271_1525727769720″,”color=light”,”wj=knots”,”tj=c”,”avg_min=0″];
    var script = document.createElement(“script”);
    var tag = document.getElementsByTagName(“script”)[0];
    script.src = “https://www.windguru.cz/js/wglive.php?”+(arg.join(“&&#8221;));
    tag.parentNode.insertBefore(script, tag);
    };
    window.addEventListener ? window.addEventListener(“load”, loader, false) : window.attachEvent(“onload”, loader);
    })(window, document);
    </script>

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter banaylor

    (@banaylor)

    Could I do something like this in the child theme; content-featured-post.php file, and then control placement with CSS?

    If I place the script code in the content-featured-post.php file, the icon appears where I want, but it appears multiple times on first image…presumably once for each feature image, rather than once per image.

    Help?

    https://mksc.org.uk/

    • This reply was modified 6 years, 10 months ago by banaylor.
    • This reply was modified 6 years, 10 months ago by banaylor.
    sacredpath

    (@sacredpath)

    Automattic Happiness Engineer

    Hi, I think instead of there, you would want to put it into perhaps the #site-banner div, which is in loop-banner.php. As you have found out, if you put it into the .site-banner-media div, it does indeed appear multiple times.

    • This reply was modified 6 years, 10 months ago by sacredpath.
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Overlay new HTML in child theme’ is closed to new replies.