Skip to content

Instantly share code, notes, and snippets.

@postphotos
Last active November 5, 2017 20:57
Show Gist options
  • Save postphotos/c30dbb1df691d44045a3d8e0f471100f to your computer and use it in GitHub Desktop.
Save postphotos/c30dbb1df691d44045a3d8e0f471100f to your computer and use it in GitHub Desktop.
Cache Buster!
// CSS example: (see wp_enqueue_style in the WP Codex)
function appcss() {
$app = '/stylesheet/app.css'; // Local path in theme
$appURI = get_stylesheet_directory_uri() . $app;
$appPath = get_template_directory() . $app;
wp_enqueue_style('app', $appURI , array(),
filemtime( $appPath ) );
}
add_action( 'wp_enqueue_scripts', 'appcss' );
// JS example: (See wp_enqueue_script in the WP Codex)
function appjs() {
$app = '/javascript/app.min.js'; // Local path in theme
$appURI = get_stylesheet_directory_uri() . $app;
$appPath = get_template_directory() . $app;
wp_enqueue_script('foundation', $appURI, array(),
filemtime( $appPath ), false);
}
add_action( 'wp_enqueue_scripts', 'appjs' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment