Reset enqueue.php
This commit is contained in:
parent
7cdaeddef7
commit
6bc5c14ee8
|
@ -5,39 +5,27 @@
|
||||||
* @package understrap
|
* @package understrap
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $filename
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
function asset_path($filename) {
|
|
||||||
$manifest_path = get_stylesheet_directory() .'/rev-manifest.json';
|
|
||||||
if ( file_exists($manifest_path ) ) {
|
|
||||||
$manifest = json_decode( file_get_contents( $manifest_path ), TRUE );
|
|
||||||
} else {
|
|
||||||
$manifest = [];
|
|
||||||
}
|
|
||||||
if ( array_key_exists( $filename, $manifest ) ) {
|
|
||||||
return $manifest[$filename];
|
|
||||||
}
|
|
||||||
return $filename;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( ! function_exists( 'understrap_scripts' ) ) {
|
if ( ! function_exists( 'understrap_scripts' ) ) {
|
||||||
/**
|
/**
|
||||||
* Load theme's JavaScript and CSS sources.
|
* Load theme's JavaScript and CSS sources.
|
||||||
*/
|
*/
|
||||||
function understrap_scripts() {
|
function understrap_scripts() {
|
||||||
|
// Get the theme data.
|
||||||
wp_enqueue_style( 'understrap-styles', get_stylesheet_directory_uri() . '/'. asset_path('css/theme.min.css'), array(), null);
|
$the_theme = wp_get_theme();
|
||||||
|
$theme_version = $the_theme->get( 'Version' );
|
||||||
|
|
||||||
|
$css_version = $theme_version . '.' . filemtime(get_template_directory() . '/css/theme.min.css');
|
||||||
|
wp_enqueue_style( 'understrap-styles', get_stylesheet_directory_uri() . '/css/theme.min.css', array(), $css_version );
|
||||||
|
|
||||||
wp_enqueue_script( 'jquery');
|
wp_enqueue_script( 'jquery');
|
||||||
wp_enqueue_script( 'popper-scripts', get_template_directory_uri() . '/js/popper.min.js', array(), false, true);
|
wp_enqueue_script( 'popper-scripts', get_template_directory_uri() . '/js/popper.min.js', array(), $theme_version, true);
|
||||||
|
|
||||||
wp_enqueue_script( 'understrap-scripts', get_template_directory_uri() . '/' . asset_path('js/theme.min.js'), array(), null, true );
|
$js_version = $theme_version . '.' . filemtime(get_template_directory() . '/js/theme.min.js');
|
||||||
|
wp_enqueue_script( 'understrap-scripts', get_template_directory_uri() . '/js/theme.min.js', array(), $js_version, true );
|
||||||
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
|
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
|
||||||
wp_enqueue_script( 'comment-reply' );
|
wp_enqueue_script( 'comment-reply' );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} // endif function_exists( 'understrap_scripts' ).
|
} // endif function_exists( 'understrap_scripts' ).
|
||||||
|
|
||||||
add_action( 'wp_enqueue_scripts', 'understrap_scripts' );
|
add_action( 'wp_enqueue_scripts', 'understrap_scripts' );
|
|
@ -5,7 +5,6 @@
|
||||||
* @package understrap
|
* @package understrap
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
add_action( 'after_setup_theme', 'understrap_woocommerce_support' );
|
add_action( 'after_setup_theme', 'understrap_woocommerce_support' );
|
||||||
if ( ! function_exists( 'understrap_woocommerce_support' ) ) {
|
if ( ! function_exists( 'understrap_woocommerce_support' ) ) {
|
||||||
/**
|
/**
|
||||||
|
@ -24,7 +23,6 @@ if ( ! function_exists( 'understrap_woocommerce_support' ) ) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* First unhook the WooCommerce wrappers
|
* First unhook the WooCommerce wrappers
|
||||||
*/
|
*/
|
||||||
|
@ -135,4 +133,4 @@ if ( ! function_exists ( 'understrap_wc_form_field_args' ) ) {
|
||||||
} // end switch ($args).
|
} // end switch ($args).
|
||||||
return $args;
|
return $args;
|
||||||
}
|
}
|
||||||
}
|
}
|
Reference in New Issue