質問編集履歴

3

インデント修正

2019/07/08 00:00

投稿

MayumiHanawa
MayumiHanawa

スコア12

test CHANGED
File without changes
test CHANGED
@@ -178,41 +178,31 @@
178
178
 
179
179
  if ( $h2s[0] ) {
180
180
 
181
- //1番目のH2見出し手前にad1を挿入
181
+ //1番目のH2見出し手前にad1を挿入
182
182
 
183
183
  if ( $h2s[0][0] ) {
184
184
 
185
-
186
-
187
- if( is_smartphone() ){
185
+ if( is_smartphone() ){
188
186
 
189
187
  $the_content = str_replace($h2s[0][0], $ad0.$h2s[0][0], $the_content);
190
188
 
191
- } else{
189
+ } else{
192
-
190
+
193
- $the_content = str_replace($h2s[0][0], $ad0.$h2s[0][0], $the_content);
191
+ $the_content = str_replace($h2s[0][0], $ad0.$h2s[0][0], $the_content);
194
-
192
+
195
- }
193
+ }
196
-
194
+
197
- }
195
+ }
198
196
 
199
197
  //4番目のH2見出し手前にad2を挿入
200
198
 
201
199
  if ( $h2s[0][3] ) {
202
200
 
203
-
204
-
205
- if( is_smartphone() ){
201
+ if( is_smartphone() ){
206
-
207
-
208
202
 
209
203
  $the_content = str_replace($h2s[0][3], $ad2.$h2s[0][3], $the_content);
210
204
 
211
-
212
-
213
- } else{
205
+ } else{
214
-
215
-
216
206
 
217
207
  $the_content = str_replace($h2s[0][3], $ad2.$h2s[0][3], $the_content);
218
208
 
@@ -224,21 +214,15 @@
224
214
 
225
215
  if ( $h2s[0][5] ) {
226
216
 
227
- if( is_smartphone() ){
217
+ if( is_smartphone() ){
228
218
 
229
219
  $the_content = str_replace($h2s[0][5], $ad2.$h2s[0][5], $the_content);
230
220
 
231
-
232
-
233
- } else{
221
+ } else{
234
-
235
-
236
222
 
237
223
  $the_content = str_replace($h2s[0][5], $ad2.$h2s[0][5], $the_content);
238
224
 
239
-
240
-
241
- }
225
+ }
242
226
 
243
227
  }
244
228
 

2

インデントの修正

2019/07/08 00:00

投稿

MayumiHanawa
MayumiHanawa

スコア12

test CHANGED
File without changes
test CHANGED
@@ -78,16 +78,12 @@
78
78
 
79
79
 
80
80
 
81
- //1番目と2番目と3番目のh2見出し手前にアドセンスを表示
81
+ //番目と番目と番目のh2見出し手前にアドセンスを表示
82
82
 
83
83
  function add_ad_before_h2_for_3times($the_content) {
84
84
 
85
85
  //最初に表示させるアドセンス
86
86
 
87
- //
88
-
89
- ////二番目に表示させるアドセンス
90
-
91
87
  $ad0 = <<< EOF
92
88
 
93
89
  <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
@@ -114,6 +110,8 @@
114
110
 
115
111
  EOF;
116
112
 
113
+ //2番目に表示させるアドセンス
114
+
117
115
  $ad1 = <<< EOF
118
116
 
119
117
  <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
@@ -136,7 +134,7 @@
136
134
 
137
135
  EOF;
138
136
 
139
- //番目に表示させるアドセンス
137
+ //3番目に表示させるアドセンス
140
138
 
141
139
  $ad2 = <<< EOF
142
140
 
@@ -198,7 +196,7 @@
198
196
 
199
197
  }
200
198
 
201
- //4番目のH2見出し手前にad1を挿入
199
+ //4番目のH2見出し手前にad2を挿入
202
200
 
203
201
  if ( $h2s[0][3] ) {
204
202
 
@@ -222,7 +220,7 @@
222
220
 
223
221
  }
224
222
 
225
- //1番目のH2見出し手前にad1を挿入
223
+ //6番目のH2見出し手前にad2を挿入
226
224
 
227
225
  if ( $h2s[0][5] ) {
228
226
 

1

書式の改善

2019/07/07 23:53

投稿

MayumiHanawa
MayumiHanawa

スコア12

test CHANGED
File without changes
test CHANGED
@@ -30,6 +30,8 @@
30
30
 
31
31
 
32
32
 
33
+ ```ここに言語を入力
34
+
33
35
  function is_smartphone(){
34
36
 
35
37
  $useragents = array(
@@ -255,3 +257,5 @@
255
257
 
256
258
 
257
259
  add_filter('the_content','add_ad_before_h2_for_3times');
260
+
261
+ ```