Load specific JavaScript files in header.php in the homepage only? in WordPress


/ Published in: PHP
Save to your folder(s)

In your header.php file:


Copy this code and paste it in your HTML
  1. <?php if(is_front_page()):?>
  2. <?php /*?>your java script code<?php */?>
  3. <script type=”text/javascipt” src=”yourfile.js”></script>
  4. <?php endif; ?>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.