WordPress.org

Ready to get started?Download WordPress

Forums

Pinterest "Pin It" Button
[resolved] Please fix Pinterest "Pin It" syntax in public-display-functions.php (3 posts)

  1. manovotny
    Member
    Posted 1 year ago #

    In the public-display-functions.php file, you are correctly adding a HTTP / HTTPS check on line 23, like so...

    wp_enqueue_script( 'pinterest-assets', 'http' . ( is_ssl() ? 's' : '' ) . '://assets.pinterest.com/js/pinit.js', null, '', true );

    Please add the same kind of check to the button image on line 101, which currently looks like this...

    $btn_img_url = '//assets.pinterest.com/images/PinExt.png';

    ...and it should look like this...

    $btn_img_url = 'http' . ( is_ssl() ? 's' : '' ) . '://assets.pinterest.com/images/PinExt.png';

    ...so it does not automatically assume which protocol to use.

    Thanks!

    http://wordpress.org/extend/plugins/pinterest-pin-it-button/

  2. Phil Derksen
    Member
    Plugin Author

    Posted 1 year ago #

    It's pretty common practice to use "protocol-less" URLs for static files like JS/images/CSS, as long as the source serves them up both ways, as in the case of CDNs.

    <script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>

    Pinterest serves up that button image this way, and their embed code also outputs it this way.

    Also, once I make the minimum requirement of WP 3.5, wp_enqueue_script won't even have that check.

    http://core.trac.wordpress.org/ticket/16560

  3. manovotny
    Member
    Posted 1 year ago #

    Phil Derksen : :

    Yes it is common practice, but that does not mean it is the best practice.

    If you use this protocol-less technique for a Pin It button in your posts, and people use MailChimp or FeedBurner to receive posts via email, email clients see the "//" and begin to search attached network drives.

    On small networks, like at home, it is less of a big deal. The email clients will search the networked drives, not find them, and the assets will not load. You lose the functionality, but the email will at least still load.

    On large networks, like major businesses and corporations, the email clients will search for forever. Most email clients do more than just give up, the flat out crash.

    This users to unsubscribe and view to drop and that is just not cool. It negatively reflects on the people / sites who use plugins like this and it is not even their fault.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic