• Hello,

    I have few ads that are inline and I want to load them as lazy load. I found a solution available on ‘https://github.com/madgex/lazy-ads&#8217;. I have to first load this javascript <script src="../path_to/lazyad-loader.min.js" async></script> and then use with ad tags.

    I will keep the file in child theme include folder. My question is where can I copy this code <script src="../path_to/lazyad-loader.min.js" async></script> such that script is available in all the site pages?

    Please advise.
    If you know of a better way to lazy load ads in the theme, please let me know.

    Thanks for your help!

Viewing 1 replies (of 1 total)
  • Hi there. Based on the recommendation in the WP Codex, you would put it in header.php, before the wp_head() call:

    <head>
    	<meta charset="<?php bloginfo('charset'); ?>">
    	<meta name="viewport" content="width=device-width, initial-scale=1.0">
    	<link rel="profile" href="http://gmpg.org/xfn/11">
    	<link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>">
    	       <------ add your script code here
    	<?php wp_head(); ?>
    </head>
Viewing 1 replies (of 1 total)

The topic ‘Adding javascript for Lazy load Ads’ is closed to new replies.