コード例 #1
0
 /**
  * @ticket 18302
  *
  * @dataProvider data_theme_files
  */
 public function test_theme_file_path_with_child_theme($file, $expected_theme, $existence)
 {
     switch_theme('theme-file-child');
     // Ensure the returned path uses the expected theme:
     $this->assertSame(WP_CONTENT_DIR . "/themes/{$expected_theme}/{$file}", get_theme_file_path($file));
     // Ensure the returned path always uses the parent theme:
     $this->assertSame(WP_CONTENT_DIR . "/themes/theme-file-parent/{$file}", get_parent_theme_file_path($file));
 }
コード例 #2
0
/**
 * Add SVG definitions to the footer.
 */
function twentyseventeen_include_svg_icons()
{
    // Define SVG sprite file.
    $svg_icons = get_parent_theme_file_path('/assets/images/svg-icons.svg');
    // If it exists, include it.
    if (file_exists($svg_icons)) {
        require_once $svg_icons;
    }
}
コード例 #3
0
/**
 * Display custom color CSS.
 */
function twentyseventeen_colors_css_wrap()
{
    if ('custom' !== get_theme_mod('colorscheme') && !is_customize_preview()) {
        return;
    }
    require_once get_parent_theme_file_path('/inc/color-patterns.php');
    $hue = absint(get_theme_mod('colorscheme_hue', 250));
    ?>
	<style type="text/css" id="custom-theme-colors" <?php 
    if (is_customize_preview()) {
        echo 'data-hue="' . $hue . '"';
    }
    ?>
>
		<?php 
    echo twentyseventeen_custom_colors_css();
    ?>
	</style>
<?php 
}