Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #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 tag

    For 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,
    Lynda

    #1002640

    Hey 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,
    Nikko

    #1002973

    Where would I find the functions.php file? In what folder?
    Is this going to affect every page in the site?
    Lynda

    #1003145

    Hi,

    Functions.php is located in the root folder of your theme, the code Nikko sent will be added to every page.

    Best regards,
    Rikard

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.