/** * Enqueue scripts and styles. */ function twentyseventeen_scripts() { // Add custom fonts, used in the main stylesheet. wp_enqueue_style('twentyseventeen-fonts', twentyseventeen_fonts_url(), array(), null); // Theme stylesheet. wp_enqueue_style('twentyseventeen-style', get_stylesheet_uri()); // Load the dark colorscheme. if ('dark' === get_theme_mod('colorscheme', 'light') || is_customize_preview()) { wp_enqueue_style('twentyseventeen-colors-dark', get_theme_file_uri('/assets/css/colors-dark.css'), array('twentyseventeen-style'), '1.0'); } // Load the Internet Explorer 9 specific stylesheet, to fix display issues in the Customizer. if (is_customize_preview()) { wp_enqueue_style('twentyseventeen-ie9', get_theme_file_uri('/assets/css/ie9.css'), array('twentyseventeen-style'), '1.0'); wp_style_add_data('twentyseventeen-ie9', 'conditional', 'IE 9'); } // Load the Internet Explorer 8 specific stylesheet. wp_enqueue_style('twentyseventeen-ie8', get_theme_file_uri('/assets/css/ie8.css'), array('twentyseventeen-style'), '1.0'); wp_style_add_data('twentyseventeen-ie8', 'conditional', 'lt IE 9'); // Load the html5 shiv. wp_enqueue_script('html5', get_theme_file_uri('/assets/js/html5.js'), array(), '3.7.3'); wp_script_add_data('html5', 'conditional', 'lt IE 9'); wp_enqueue_script('twentyseventeen-skip-link-focus-fix', get_theme_file_uri('/assets/js/skip-link-focus-fix.js'), array(), '1.0', true); $twentyseventeen_l10n = array('quote' => twentyseventeen_get_svg(array('icon' => 'quote-right'))); if (has_nav_menu('top')) { wp_enqueue_script('twentyseventeen-navigation', get_theme_file_uri('/assets/js/navigation.js'), array(), '1.0', true); $twentyseventeen_l10n['expand'] = __('Expand child menu', 'twentyseventeen'); $twentyseventeen_l10n['collapse'] = __('Collapse child menu', 'twentyseventeen'); $twentyseventeen_l10n['icon'] = twentyseventeen_get_svg(array('icon' => 'angle-down', 'fallback' => true)); } wp_enqueue_script('twentyseventeen-global', get_theme_file_uri('/assets/js/global.js'), array('jquery'), '1.0', true); wp_enqueue_script('jquery-scrollto', get_theme_file_uri('/assets/js/jquery.scrollTo.js'), array('jquery'), '2.1.2', true); wp_localize_script('twentyseventeen-skip-link-focus-fix', 'twentyseventeenScreenReaderText', $twentyseventeen_l10n); if (is_singular() && comments_open() && get_option('thread_comments')) { wp_enqueue_script('comment-reply'); } }
/** * Load dynamic logic for the customizer controls area. */ function twentyseventeen_panels_js() { wp_enqueue_script('twentyseventeen-customize-controls', get_theme_file_uri('/assets/js/customize-controls.js'), array(), '1.0', true); }
/** * @ticket 18302 * * @dataProvider data_theme_files */ public function test_theme_file_uri_returns_valid_uri($file, $expected_theme, $existence) { $uri = get_theme_file_uri($file); $parent_uri = get_parent_theme_file_uri($file); $this->assertSame(esc_url_raw($uri), $uri); $this->assertSame(esc_url_raw($parent_uri), $parent_uri); }