WordPress.org

Ready to get started?Download WordPress

Forums

Jetpack by WordPress.com
[resolved] Share images, css & js not loading from subdomain. (2 posts)

  1. Hayden James
    Member
    Posted 1 year ago #

    I have all images, css and js loading from images.domain.com css.domain.com and js.domain.com respectively. All other plugins the images, css, js load from those respective domains. But JP sharing buttons and css & js are still loading from domain.com.

    What file can I edit to make sure it obeys rewrites like all other plugins or how can I manually setup css & js as per the "Disable CSS and JS" option. Is there a guide or how to page for that?

    Thanks

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

  2. Jeremy Herve
    Happiness Engineer
    Plugin Author

    Posted 1 year ago #

    Once you've checked the "Disable CSS and JS" 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:

    function tweakjp_add_sharing_js() {
        wp_enqueue_script( 'sharing-js-fe', YOUR_OWN_WP_SHARING_PLUGIN_URL . 'sharing.js', array( ), 3 );
    }
    add_action( 'wp_enqueue_scripts', 'tweakjp_add_sharing_js' );
    
    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.