Last active
November 5, 2017 20:57
-
-
Save postphotos/c30dbb1df691d44045a3d8e0f471100f to your computer and use it in GitHub Desktop.
Cache Buster!
This file contains 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
// 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