Last active
January 9, 2019 01:36
-
-
Save jwwicks/9dc60f07cdcaf3bfb104312e00e266de to your computer and use it in GitHub Desktop.
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 | |
/** | |
* @package Wordpress JetPack Theme Hooks | |
* @author jwwicks | |
* @copyright Copyright (C) 2017 jwwicks | |
* @license GNU/GPLv2 and later | |
* | |
* http://www.gnu.org/licenses/gpl-2.0.html | |
* | |
* Note: Place the code below in your functions.php theme file | |
*/ | |
/** | |
* Enable JetPack Development mode selectively based on subdomain | |
* | |
* www.domain.com - production mode | |
* develop.domain.com - development mode | |
* staging.domain.com - development mode | |
* | |
*/ | |
if(!function_exists('onEnableJetPackDevelopmentMode')){ | |
function onEnableJetPackDevelopmentMode($is_development_mode){ | |
$parts = explode('.', $_SERVER['SERVER_NAME']); | |
/* Assumes www.domain.com format | |
adjust array as needed below to suit your setup | |
*/ | |
if(in_array($parts[0], array('develop', 'staging'))){ | |
$is_development_mode = true; | |
} | |
return $is_development_mode; | |
} | |
} | |
add_filter('jetpack_development_mode', 'onEnableJetPackDevelopmentMode', 10, 1); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment