WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

According to the Pinterest website in order to add the Pinterest button to any page I have to add the following just below the closing body tag:

<script type="text/javascript" src="//assets.pinterest.com/js/pinit.js"></script>

What's the best way to do this?

Should I follow the link, grab the script and use wp_enqueue_script? Or can I somehow include the script element another way?


share|improve this question
up vote 2 down vote accepted

Yes, you have to use wp_enqueue_script function. Pass $in_footer argument as true and your script will be added before closing body:

function my_scripts_method() {
    wp_enqueue_script( 'pinterest', '//assets.pinterest.com/js/pinit.js', array(), false, true);
add_action( 'wp_enqueue_scripts', 'my_scripts_method' );
share|improve this answer
Actually the url gave me a 404 error, but that's exactly what was on the pinterest page. When I added the fully qualified url it gave me the script. Am I missing something? – jw60660 Jun 7 '12 at 4:52
@jw60660 Don't know, use fully qualified script. – Eugene Manuilov Jun 7 '12 at 5:20

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.