diff options
| author | Max | 2018-10-15 23:46:42 +0200 |
|---|---|---|
| committer | Max | 2018-10-15 23:46:42 +0200 |
| commit | 00c9709fd9763542e848f6278db8ba26af5c9886 (patch) | |
| tree | 92cb1c1ee4c467118e1e5a4c7e233d3feac6efa8 /inc/enqueue.php | |
| download | fuselkoenig_de-00c9709fd9763542e848f6278db8ba26af5c9886.tar.gz | |
Initial commit.
Diffstat (limited to 'inc/enqueue.php')
| -rw-r--r-- | inc/enqueue.php | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/inc/enqueue.php b/inc/enqueue.php new file mode 100644 index 0000000..a51937f --- /dev/null +++ b/inc/enqueue.php @@ -0,0 +1,34 @@ +<?php +/** + * Understrap enqueue scripts + * + * @package understrap + */ + +if ( ! defined( 'ABSPATH' ) ) { + exit; // Exit if accessed directly. +} + +if ( ! function_exists( 'understrap_scripts' ) ) { + /** + * Load theme's JavaScript and CSS sources. + */ + function understrap_scripts() { + // Get the theme data. + $the_theme = wp_get_theme(); + $theme_version = $the_theme->get( 'Version' ); + + $css_version = $theme_version . '.' . filemtime(get_template_directory() . '/css/theme.css'); + wp_enqueue_style( 'theme-styles', get_stylesheet_directory_uri() . '/css/theme.css', array(), $css_version ); + + wp_enqueue_script( 'jquery'); + + $js_version = $theme_version . '.' . filemtime(get_template_directory() . '/js/theme.min.js'); + wp_enqueue_script( 'theme-scripts', get_template_directory_uri() . '/js/theme.min.js', array(), $js_version, true ); + if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) { + wp_enqueue_script( 'comment-reply' ); + } + } +} // endif function_exists( 'understrap_scripts' ). + +add_action( 'wp_enqueue_scripts', 'understrap_scripts' ); |
