Skip to content

Instantly share code, notes, and snippets.

@tankbar
Created August 25, 2017 12:04
Show Gist options
  • Save tankbar/248195da65c9aa5477f0ca30cb5d1ef0 to your computer and use it in GitHub Desktop.
Save tankbar/248195da65c9aa5477f0ca30cb5d1ef0 to your computer and use it in GitHub Desktop.
ENQUEUE SCRIPTS AND STYLES WITH AUTOMATIC VERSIONING
//Instead of WP default
//<link rel='stylesheet' id='child-theme-css' href='http://mysite.com/wp-content/themes/child/css/styles.min.css?ver=4.3.1' type='text/css' media='all' />
//You get this every time the minified CSS is saved and compressed:
//<link rel='stylesheet' id='child-theme-css' href='http://mysite.com/wp-content/themes/child/css/styles.min.css?ver=1447781986' type='text/css' media='all' />
<?php
$themecsspath = get_stylesheet_directory() . '/css/styles.min.css';
wp_enqueue_style(
'child-theme',
get_stylesheet_directory_uri() . '/css/styles.min.css',
array(),
filemtime( $themecsspath )
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment