Skip to content

Instantly share code, notes, and snippets.

@guwordpressbrasil
Created November 21, 2013 18:12
Show Gist options
  • Save guwordpressbrasil/7586637 to your computer and use it in GitHub Desktop.
Save guwordpressbrasil/7586637 to your computer and use it in GitHub Desktop.
Prevenir cache de CSS
function url_fresh($url = '', $echo = true){ //http://css-tricks.com/snippets/wordpress/prevent-css-caching/
if($echo){
echo get_stylesheet_directory_uri().'/'.$url.'?r='.filemtime( get_stylesheet_directory().'/'.$url);
}else{
return get_stylesheet_directory_uri().'/'.$url.'?r='.filemtime( get_stylesheet_directory().'/'.$url);
}
}
function carrega_scripts() {
wp_register_script('bootstrap', url_fresh('js/vendor/bootstrap.min.js',false),array('jquery'),false,false);
wp_enqueue_script('bootstrap');
}
add_action('wp_enqueue_scripts', 'carrega_scripts');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment