Created
August 31, 2012 05:11
-
-
Save mjangda/3549265 to your computer and use it in GitHub Desktop.
Manually load Jetpack modules (e.g. for dev or offline environments); drop this in your mu-plugins folder
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// TODO: don't run if Jetpack is active | |
add_action( 'plugins_loaded', function() { | |
if ( ! file_exists( WP_PLUGIN_DIR . '/jetpack/' ) ) | |
return; | |
$modules = array( | |
'modules/contact-form.php', | |
'modules/shortcodes.php', | |
'modules/widgets.php', | |
'modules/comments.php', | |
'modules/carousel.php', | |
'modules/custom-css.php', | |
'modules/sharedaddy.php', | |
'modules/gravatar-hovercards.php', | |
'modules/minileven.php', | |
'class.jetpack-user-agent.php', | |
); | |
foreach ( $modules as $module ) { | |
require_once( WP_PLUGIN_DIR . '/jetpack/' . $module ); | |
} | |
}, 99 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is pure gold, I can finally develop locally with the ShareDaddy plugin.
Is this in the VIP documentation?
EDIT: I added a condition to check if the class "Jetpack" exists, because although the Jetpack files may exist, the plugin may not be activated, and if it's not, the function above will throw a fatal error.
if ( ! file_exists( WP_PLUGIN_DIR . '/jetpack/' ) || ! class_exists( 'Jetpack' ) ) {
return;
}