Sourabh
Sourabh

Reputation: 4253

add js to wordpress with custom attributes

I want to add the following code to footer of my wordpress website. What would be the best possible way to do it.

<script async defer data-pin-hover="true" src="//assets.pinterest.com/js/pinit.js"></script>

Upvotes: 0

Views: 205

Answers (2)

Tibin
Tibin

Reputation: 644

Goto themes, ->Editor find footer.php and paste code snippet..

Upvotes: 2

Rajkumar Gour
Rajkumar Gour

Reputation: 1159

You can use wp_footer hook to get this script in footer. Place the below code in your themes functions.php file.

add_action('wp_footer', 'add_script', 100);
function add_script(){
     echo '<script async defer data-pin-hover="true" src="//assets.pinterest.com/js/pinit.js"></script>';
}

Upvotes: 0

Related Questions