• I have Pinterest Js file and functions for displaying Pinterest directly inside all times on the website. I wish to limit it to images that are displayed only inside posts and not on featured images.

    This is the functions code that is linked to Pinterest JS. What do I need to change to limit it to images inside posts only?

    add_action( 'wp_enqueue_scripts', 'wpsites_pin_images_script' );
    
    function wpsites_pin_images_script() {
        wp_register_script( 'pin-images',
            get_stylesheet_directory_uri() . '/pin.js',
            false,
            '1.0',
            true
        );
    
        wp_enqueue_script( 'pin-images' );
    }
    
    Pin.js new file
    
    (function(d){
      var f = d.getElementsByTagName('SCRIPT')[0], p = d.createElement('SCRIPT');
      p.type = 'text/javascript';
      p.setAttribute('data-pin-hover', true);
      p.async = true;
      p.src = '//assets.pinterest.com/js/pinit.js';
      f.parentNode.insertBefore(p, f);
    }(document));
  • The topic ‘Pinterest Functions Editing’ is closed to new replies.