Add timestamp to CSS and JS URLs to cachebust
This commit is contained in:
@@ -1 +1,8 @@
|
||||
<script type="text/javascript" src="<?php echo get_template_directory_uri() ?>/bundle.js"></script>
|
||||
<?php
|
||||
$js_url = get_template_directory_uri() . '/bundle.js';
|
||||
$deploy_timestamp = windycoys_get_deploy_timestamp();
|
||||
if ($deploy_timestamp) {
|
||||
$js_url .= '?t=' . $deploy_timestamp;
|
||||
}
|
||||
?>
|
||||
<script type="text/javascript" src="<?php echo $js_url ?>"></script>
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
class Windycoys_Walker_Comment extends Walker_Comment {
|
||||
function start_el(&$output, $comment, $depth = 0) {
|
||||
$id = $comment->comment_ID;
|
||||
@@ -84,3 +83,11 @@ function windycoys_search_posts_per_page($query) {
|
||||
return $query;
|
||||
}
|
||||
add_filter('pre_get_posts', 'windycoys_search_posts_per_page');
|
||||
|
||||
function windycoys_get_deploy_timestamp() {
|
||||
if (file_exists(__DIR__ . '/.timestamp')) {
|
||||
$timestamp = file_get_contents(__DIR__ . '/.timestamp');
|
||||
return $timestamp;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
<?php
|
||||
$css_url = get_template_directory_uri() . '/style.css';
|
||||
$deploy_timestamp = windycoys_get_deploy_timestamp();
|
||||
if ($deploy_timestamp) {
|
||||
$css_url .= '?t=' . $deploy_timestamp;
|
||||
}
|
||||
?>
|
||||
<!doctype html>
|
||||
<html <?php language_attributes(); ?>>
|
||||
<head>
|
||||
@@ -7,7 +14,7 @@
|
||||
<meta name="theme-color" content="#4b88b6">
|
||||
<meta name="description" content="<?php bloginfo('description'); ?>">
|
||||
<?php wp_head(); ?>
|
||||
<link rel="stylesheet" href="<?php echo get_template_directory_uri(); ?>/style.css">
|
||||
<link rel="stylesheet" href="<?php echo $css_url ?>">
|
||||
<link href="//fonts.googleapis.com/css?family=Open+Sans|Raleway:700" rel="stylesheet">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
Reference in New Issue
Block a user