Skip to content

Commit 1cbacb1

Browse files
committed
added plugin version to style.css
added plugin version check to style.css
1 parent f141a30 commit 1cbacb1

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

includes/wcdn-template-functions.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,9 @@ function wcdn_navigation() {
152152
*/
153153
function wcdn_template_stylesheet( $template_type ) {
154154
global $wcdn;
155-
$name = apply_filters( 'wcdn_template_stylesheet_name', 'style.css' );
155+
$name = apply_filters( 'wcdn_template_stylesheet_name', 'style.css' );
156+
$plugin_data = get_plugin_data( WP_PLUGIN_DIR . '/woocommerce-delivery-notes/woocommerce-delivery-notes.php' );
157+
$plugin_version = isset( $plugin_data['Version'] ) ? $plugin_data['Version'] : '1.0.0';
156158
// phpcs:disable
157159

158160
if ( 'delivery-note' === $template_type ) {
@@ -162,11 +164,11 @@ function wcdn_template_stylesheet( $template_type ) {
162164
$setting['template_setting']['template_setting_template'] = get_option( 'wcdn_template_type' );
163165
if ( isset( $setting['template_setting']['template_setting_template'] ) && 'simple' == $setting['template_setting']['template_setting_template'] ) {
164166
?>
165-
<link rel="stylesheet" href="<?php echo esc_url( $wcdn->print->get_template_file_location( $name, true ) ) . 'simple/' . esc_html( $name ); ?>" type="text/css" media="screen,print" />
167+
<link rel="stylesheet" href="<?php echo esc_url( $wcdn->print->get_template_file_location( $name, true ) ) . 'simple/' . esc_html( $name ). '?v=' . esc_html( $plugin_version ); ?>" type="text/css" media="screen,print" />
166168
<?php
167169
} else {
168170
?>
169-
<link rel="stylesheet" href="<?php echo esc_url( $wcdn->print->get_template_file_location( $name, true ) ) . esc_html( $name ); ?>" type="text/css" media="screen,print" />
171+
<link rel="stylesheet" href="<?php echo esc_url( $wcdn->print->get_template_file_location( $name, true ) ) . esc_html( $name ). '?v=' . esc_html( $plugin_version ); ?>" type="text/css" media="screen,print" />
170172
<?php
171173
}
172174

0 commit comments

Comments
 (0)