-
AuthorPosts
-
August 28, 2018 at 12:12 am #1002469
I need to add javascript that will allow images from my portfolio entries to be saved to Pinterest. (sample entry: https://chapmaniwerks.com/portfolio-item/chris-chapman-pastels/)
Where to I add javascript within the portfolio entry interface in Enfold? Here’s the developer instructions from Pinterest:
Place our JavaScript in the right spot
If you’re hotlinking our script tag (using the single-line script tag method), put the tag as close to the end of your body tag as possible. You’ll run into trouble if you place our script tag somewhere else, like in:The document’s head
A repeating template
Just above an important, visible part of the page in the middle of the body tag
A long, hard-to-render table tagFor best results, asynchronously load the script tag. You can asynchronously load our JavaScript by copying and pasting the following snippet anywhere on your page. (This replaces any other pinit.js script you have on your page.)
<script type=”text/javascript”>
(function(d){
var f = d.getElementsByTagName(‘SCRIPT’)[0], p = d.createElement(‘SCRIPT’);
p.type = ‘text/javascript’;
p.async = true;
p.src = ‘//assets.pinterest.com/js/pinit.js’;
f.parentNode.insertBefore(p, f);
}(document));
</script>
Thanks,
LyndaAugust 28, 2018 at 11:51 am #1002640Hey auroradesignstudio,
Can you try adding this php code at the bottom of your functions.php:
//------------------------------- // Custom script in head section //------------------------------- function pinit_js(){ ?> <script type="text/javascript"> (function(d){ var f = d.getElementsByTagName('SCRIPT')[0], p = d.createElement('SCRIPT'); p.type = 'text/javascript'; p.async = true; p.src = '//assets.pinterest.com/js/pinit.js'; f.parentNode.insertBefore(p, f); }(document)); </script> <?php } add_action('wp_head', 'pinit_js');
Let us know if this helps.
Best regards,
NikkoAugust 29, 2018 at 5:34 am #1002973Where would I find the functions.php file? In what folder?
Is this going to affect every page in the site?
LyndaAugust 29, 2018 at 2:04 pm #1003145 -
AuthorPosts
- You must be logged in to reply to this topic.