Skip to content

Instantly share code, notes, and snippets.

@peterwilsoncc
Created March 22, 2012 02:31
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save peterwilsoncc/2155237 to your computer and use it in GitHub Desktop.
Save peterwilsoncc/2155237 to your computer and use it in GitHub Desktop.
Live reload WordPress extension
<?php
/*
Plugin Name: LiveReload
Description: Adds the JavaScript for LiveReload to a WordPress site
Version: 0.0.0.0.1alpha
Author: Peter Wilson
Author URI: http://peterwilson.cc/
*/
function pwcc_live_reload_js() {
?>
<script>document.write('<script src="http://' + (location.host || 'localhost').split(':')[0] + ':35729/livereload.js?snipver=1"></' + 'script>')</script>
<?php
}
add_action('wp_footer', 'pwcc_live_reload_js')
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment