-
Notifications
You must be signed in to change notification settings - Fork 46
Expand file tree
/
Copy pathheader.php
More file actions
87 lines (77 loc) · 3.72 KB
/
Copy pathheader.php
File metadata and controls
87 lines (77 loc) · 3.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
<?php
/**
* Cocoon WordPress Theme
* @author: yhira
* @link: https://wp-cocoon.com/
* @license: http://www.gnu.org/licenses/gpl-2.0.html GPL v2 or later
*/
if ( !defined( 'ABSPATH' ) ) exit; ?>
<!doctype html>
<html <?php language_attributes(); ?>>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover">
<meta name="referrer" content="<?php echo apply_filters('cocoon_meta_referrer_content', get_meta_referrer_content()); ?>">
<meta name="format-detection" content="telephone=no">
<?php //ヘッドタグ内挿入用のアクセス解析用テンプレート
cocoon_template_part('tmp/head-analytics'); ?>
<?php //AMPの案内タグを出力
if ( has_amp_page() ): ?>
<link rel="amphtml" href="<?php echo get_amp_permalink(); ?>">
<?php endif ?>
<?php //Google Search Consoleのサイト認証IDの表示
if ( get_google_search_console_id() ): ?>
<!-- Google Search Console -->
<meta name="google-site-verification" content="<?php echo get_google_search_console_id() ?>" />
<!-- /Google Search Console -->
<?php endif;//Google Search Console終了 ?>
<?php //preconnect dns-prefetch
$domains = list_text_to_array(get_pre_acquisition_list());
if ($domains) {
echo '<!-- preconnect dns-prefetch -->'.PHP_EOL;
}
foreach ($domains as $domain): ?>
<link rel="preconnect dns-prefetch" href="//<?php echo $domain; ?>">
<?php endforeach; ?>
<!-- Preload -->
<link rel="preload" as="font" type="font/woff" href="<?php echo FONT_ICOMOON_WOFF_URL; ?>" crossorigin="anonymous">
<?php if (is_site_icon_font_font_awesome_4()): ?>
<link rel="preload" as="font" type="font/woff2" href="<?php echo FONT_AWESOME_4_WOFF2_URL; ?>" crossorigin="anonymous">
<?php else: ?>
<link rel="preload" as="font" type="font/woff2" href="<?php echo FONT_AWESOME_5_BRANDS_WOFF2_URL; ?>" crossorigin="anonymous">
<link rel="preload" as="font" type="font/woff2" href="<?php echo FONT_AWESOME_5_REGULAR_WOFF2_URL; ?>" crossorigin="anonymous">
<link rel="preload" as="font" type="font/woff2" href="<?php echo FONT_AWESOME_5_SOLID_WOFF2_URL; ?>" crossorigin="anonymous">
<?php endif; ?>
<?php // ヘッダー背景画像のpreload
$header_image_url = get_header_background_image_url();
if ($header_image_url):
// ヘッダー画像のURLがサイトドメインと同じかどうかを判定
$header_image_domain = get_domain_name($header_image_url);
$site_domain = get_the_site_domain();
// 両方のドメインが取得できて、かつ同じ場合のみtrue
$is_same_domain = false;
if ($header_image_domain && $site_domain) {
$is_same_domain = ($header_image_domain === $site_domain);
}
// サイトドメインと同じ場合はcrossoriginを削除、異なる場合は追加
$crossorigin_attr = $is_same_domain ? '' : ' crossorigin="anonymous"';
?>
<link rel="preload" as="image" href="<?php echo esc_url($header_image_url); ?>" fetchpriority="high"<?php echo $crossorigin_attr; ?>>
<?php endif; ?>
<?php //WordPressが出力するヘッダー情報
wp_head();
?>
<?php //カスタムフィールドの挿入(カスタムフィールド名:head_custom
cocoon_template_part('tmp/head-custom-field'); ?>
<?php //headで読み込む必要があるJavaScript
cocoon_template_part('tmp/head-javascript'); ?>
<?php //PWAスクリプト
cocoon_template_part('tmp/head-pwa'); ?>
<?php //ヘッドタグ内挿入用のユーザー用テンプレート
cocoon_template_part('tmp-user/head-insert'); ?>
</head>
<body <?php body_class(); ?> itemscope itemtype="https://schema.org/WebPage">
<?php //body最初に挿入するアクセス解析ヘッダータグの取得
cocoon_template_part('tmp/body-top-analytics'); ?>
<?php //サイトヘッダーからコンテンツまでbodyタグ最初のHTML
cocoon_template_part('tmp/body-top'); ?>