質問編集履歴

2

コード修正

2018/01/29 12:49

投稿

Naokoro
Naokoro

スコア19

test CHANGED
File without changes
test CHANGED
@@ -30,7 +30,7 @@
30
30
 
31
31
  ★メタ部コード(header.php)
32
32
 
33
- <!-- header -->
33
+ <!-- header -->
34
34
 
35
35
  <header itemscope itemtype="http://schema.org/WPHeader">
36
36
 
@@ -56,15 +56,29 @@
56
56
 
57
57
  ?>" />
58
58
 
59
+
60
+
59
- <meta name="twitter:image:src" content="<?php echo catch_that_image(); ?>">
61
+ <meta name="twitter:image" content="<?php
62
+
63
+ if(has_post_thumbnail( $post->ID )):
64
+
65
+ $thumbnail_id = get_post_thumbnail_id();
66
+
67
+ $thumbnail_img = wp_get_attachment_image_src( $thumbnail_id , 'thumbnail' );
68
+
69
+ echo $thumbnail_img[0];
70
+
71
+ else:
72
+
73
+ echo "";
74
+
75
+ endif;
76
+
77
+ ?>" />
60
78
 
61
79
 
62
80
 
63
- <?php endif; ?>
81
+ <?php endif; ?>
64
-
65
-
66
-
67
-
68
82
 
69
83
  <?php //カスタムヘッダーがある場合
70
84
 

1

コード追記

2018/01/29 12:49

投稿

Naokoro
Naokoro

スコア19

test CHANGED
File without changes
test CHANGED
@@ -23,3 +23,89 @@
23
23
 
24
24
 
25
25
  ![イメージ説明](4f163dd00f60309ba4369cdc41e43dc2.png)
26
+
27
+
28
+
29
+
30
+
31
+ ★メタ部コード(header.php)
32
+
33
+ <!-- header -->
34
+
35
+ <header itemscope itemtype="http://schema.org/WPHeader">
36
+
37
+ <div id="header" class="clearfix">
38
+
39
+ <div id="header-in">
40
+
41
+
42
+
43
+
44
+
45
+ <?php if(is_single()): ?>
46
+
47
+ <meta name="twitter:card" content="summary_large_image" />
48
+
49
+ <meta name="twitter:site" content="@naosukenya" />
50
+
51
+ <meta name="twitter:title" content="<?php the_title(); ?>" />
52
+
53
+ <meta name="twitter:description" content="<?php
54
+
55
+ echo get_post_meta($post->ID, _aioseop_description, true);
56
+
57
+ ?>" />
58
+
59
+ <meta name="twitter:image:src" content="<?php echo catch_that_image(); ?>">
60
+
61
+
62
+
63
+ <?php endif; ?>
64
+
65
+
66
+
67
+
68
+
69
+ <?php //カスタムヘッダーがある場合
70
+
71
+ // $h_top_style = '';
72
+
73
+ // if (get_header_image()){
74
+
75
+ // $h_top_style = ' style="background-image:url('.get_header_image().')"';
76
+
77
+ // } ?>
78
+
79
+ <div id="h-top"<?php //echo $h_top_style; ?>>
80
+
81
+ <?php get_template_part('button-menu'); //モバイルメニューボタンの呼び出し?>
82
+
83
+
84
+
85
+ <div class="alignleft top-title-catchphrase">
86
+
87
+ <?php get_template_part('header-logo');?>
88
+
89
+ </div>
90
+
91
+
92
+
93
+ <div class="alignright top-sns-follows">
94
+
95
+ <?php if ( is_top_follows_visible() ): //トップのフォローボタンを表示するか?>
96
+
97
+ <?php get_template_part('sns-pages'); //SNSフォローボタンの呼び出し?>
98
+
99
+ <?php endif; ?>
100
+
101
+ </div>
102
+
103
+
104
+
105
+ </div><!-- /#h-top -->
106
+
107
+ </div><!-- /#header-in -->
108
+
109
+ </div><!-- /#header -->
110
+
111
+ </header>