WordPress.org

Ready to get started?Download WordPress

Forums

Jetpack by WordPress.com
[resolved] BUG? Jetpack Photon won't serve Jetpack Sahring buttons (2 posts)

  1. pazzaglia
    Member
    Posted 1 year ago #

    I've been putting my website on a resource diet. I need to be wary of any plug-in that is pinging my server too much or using too much bandwidth so Photon is overall a life-saver.

    HOWEVER, one of the biggest resource hogs I haven't been able to tame is the Jetpack Sharing buttons - the facebook, twitter, pinterest, print, etc. images are loaded one at a time - that's about 10 hits to the server for every page I load from the sharing buttons alone!

    Though the graphics do not take up much bandwidth each ping to the server (no matter how big) is using up resources.

    I'm surprised that the Jetpack Photon isn't serving images from Jetpack's own plug-ins!

    Or.. am I doing something wrong?

    Thanks,

    L

    P.S. Example page, if needed:
    http://www.hippressurecooking.com/peasant-fare-pressure-cooker-ligurian-bean-stew/

    http://wordpress.org/extend/plugins/jetpack/

  2. Jeremy Herve
    Happiness Engineer
    Plugin Author

    Posted 1 year ago #

    Jetpack Photon only caches and serves images in your post content. It can't be used as a standard CDN to cache and serve all resources on your site.

    Luckily, the sharing module includes an option to allow you to serve your own CSS and JS instead of Jetpack's. To do so, please go to Settings > Sharing in your dashboard, and check the "Disable CSS and JS" option.

    Once you've checked the option, you will be able to manually enqueue your own sharing js and css files.

    Jetpack uses the WP_SHARING_PLUGIN_URL constant to build the path to load the libraries. You could change that constant by your own when re enqueueing the sharing libraries, like so:

    // If you want to re enqueue Jetpack's JS library, use the WP_SHARING_PLUGIN_URL constant
    function tweakjp_add_sharing_js() {
        wp_enqueue_script( 'sharing-js-fe', WP_SHARING_PLUGIN_URL . 'sharing.js', array( ), 3 );
    }
    add_action( 'wp_enqueue_scripts', 'tweakjp_add_sharing_js' );
    
    // But for CSS, you will want to use your own stylesheet, calling your own custom icons, using CSS sprites for example
    function tweakjp_add_sharing_css() {
        wp_enqueue_style( 'sharing', YOUR_OWN_WP_SHARING_PLUGIN_URL.'sharing.css', false, JETPACK__VERSION );
    }
    add_action( 'wp_enqueue_scripts', 'tweakjp_add_sharing_css' );

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.