Last active
December 31, 2015 04:29
-
-
Save mannieschumpert/7934810 to your computer and use it in GitHub Desktop.
Optionally enqueue LiveReload for local development.
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 | |
/** | |
* Enqueue LiveReload if local install | |
* | |
* Assumes livereload.js is in the root folder of your local site | |
* | |
* This should be fairly reliable, | |
* but may need to be changed for some environments | |
*/ | |
if ( $_SERVER['REMOTE_ADDR'] === '127.0.0.1' ){ | |
add_action( 'wp_enqueue_scripts', 'enqueue_livereload' ); | |
} | |
function enqueue_livereload(){ | |
wp_enqueue_script( 'livereload', site_url().'/livereload.js', '', NULL ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Cool. Sorry I missed this.
Yeah, what
site_url
andhome_url
reference does indeed depend on individual installation configurations.