質問編集履歴
7
最新記事ではなく最近の投稿と書き直しました。
test
CHANGED
File without changes
|
test
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
大変申し訳ありませんでした。実は当方がやりたいことがございまして、ワードプレスの最
|
1
|
+
大変申し訳ありませんでした。実は当方がやりたいことがございまして、ワードプレスの最近の投稿のウィジェットのところで、そこの記事を選択すると、single.phpが表示されてしまいます。そうではなく、投稿一覧の方に行ってほしくて、何ページ目かをゲットしたかったです。ゲットできても上手くいくかわからないので、無責任な質問でした。申し訳ございません。やりたいことは、最近の投稿のところを選択して、リンクが投稿一覧のほうに遷移することです。
|
2
2
|
|
3
3
|
|
4
4
|
|
@@ -495,3 +495,7 @@
|
|
495
495
|
```
|
496
496
|
|
497
497
|
javascriptのほうが間違っていたので変更しました。
|
498
|
+
|
499
|
+
|
500
|
+
|
501
|
+
最新記事ではなく最近の投稿と書き直しました。
|
6
間違えていたので補正しました。
test
CHANGED
File without changes
|
test
CHANGED
@@ -468,7 +468,7 @@
|
|
468
468
|
|
469
469
|
});
|
470
470
|
|
471
|
-
|
471
|
+
//続きを読む ajaxでページ遷移せずにsingle.phpの一部が表示される
|
472
472
|
|
473
473
|
});
|
474
474
|
|
@@ -493,3 +493,5 @@
|
|
493
493
|
|
494
494
|
|
495
495
|
```
|
496
|
+
|
497
|
+
javascriptのほうが間違っていたので変更しました。
|
5
足りないところがあったので足しました
test
CHANGED
File without changes
|
test
CHANGED
@@ -425,3 +425,71 @@
|
|
425
425
|
```
|
426
426
|
|
427
427
|
当方はワードプレス初心者ですがよろしくお願いします。
|
428
|
+
|
429
|
+
|
430
|
+
|
431
|
+
追記です。
|
432
|
+
|
433
|
+
javascriptが使えるプラグイン
|
434
|
+
|
435
|
+
```javascript
|
436
|
+
|
437
|
+
jQuery(function() {
|
438
|
+
|
439
|
+
jQuery(".menu li").hover(function() {
|
440
|
+
|
441
|
+
jQuery(this).children('ul').show();
|
442
|
+
|
443
|
+
}, function() {
|
444
|
+
|
445
|
+
jQuery(this).children('ul').hide();
|
446
|
+
|
447
|
+
});//プルダウンメニューが表示されます
|
448
|
+
|
449
|
+
|
450
|
+
|
451
|
+
var page;
|
452
|
+
|
453
|
+
|
454
|
+
|
455
|
+
jQuery('.more a').on('click', function(event) {
|
456
|
+
|
457
|
+
//aリンクの動作を停止
|
458
|
+
|
459
|
+
event.preventDefault();
|
460
|
+
|
461
|
+
//リンク先URLを取得
|
462
|
+
|
463
|
+
page = jQuery(this).attr('href');
|
464
|
+
|
465
|
+
jQuery(this).parent().load(page+' div.post-content p',function(){
|
466
|
+
|
467
|
+
jQuery(this).parent().children().eq(0).hide();
|
468
|
+
|
469
|
+
});
|
470
|
+
|
471
|
+
jQuery(this).parent().parent().children().eq(2).css('display', 'block');//続きを読む ajaxでページ遷移せずにsingle.phpの一部が表示される
|
472
|
+
|
473
|
+
});
|
474
|
+
|
475
|
+
jQuery('a[href^=#]').click(function(){
|
476
|
+
|
477
|
+
var speed = 500;
|
478
|
+
|
479
|
+
var href= jQuery(this).attr("href");
|
480
|
+
|
481
|
+
var target = jQuery(href == "#" || href == "" ? 'html' : href);
|
482
|
+
|
483
|
+
var position = target.offset().top;
|
484
|
+
|
485
|
+
jQuery("html, body").animate({scrollTop:position}, speed, "swing");
|
486
|
+
|
487
|
+
return false;
|
488
|
+
|
489
|
+
});//ページ内リンクすることができる
|
490
|
+
|
491
|
+
});
|
492
|
+
|
493
|
+
|
494
|
+
|
495
|
+
```
|
4
質問が悪かったので全文書き直しました。
test
CHANGED
File without changes
|
test
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
ワードプレスで記事を
|
1
|
+
大変申し訳ありませんでした。実は当方がやりたいことがございまして、ワードプレスの最新記事のウィジェットのところで、そこの記事を選択すると、single.phpが表示されてしまいます。そうではなく、投稿一覧の方に行ってほしくて、何ページ目かをゲットしたかったです。ゲットできても上手くいくかわからないので、無責任な質問でした。申し訳ございません。やりたいことは、最新記事のところを選択して、リンクが投稿一覧のほうに遷移することです。
|
2
2
|
|
3
3
|
|
4
4
|
|
@@ -24,6 +24,14 @@
|
|
24
24
|
|
25
25
|
?>
|
26
26
|
|
27
|
+
<?php $p_slug = get_page_uri(get_the_ID()); ?>
|
28
|
+
|
29
|
+
<div id="<?php echo $p_slug ?>"></div>
|
30
|
+
|
31
|
+
|
32
|
+
|
33
|
+
<div id="test"></div>
|
34
|
+
|
27
35
|
<div class="post">
|
28
36
|
|
29
37
|
<div class="post-header">
|
@@ -68,20 +76,22 @@
|
|
68
76
|
|
69
77
|
<?php the_content('',false,''); ?>
|
70
78
|
|
71
|
-
|
72
|
-
|
73
79
|
</div>
|
74
80
|
|
81
|
+
|
82
|
+
|
83
|
+
<div class="more"><a href="<?php the_permalink(); ?>">続きを読む</a></div>
|
84
|
+
|
85
|
+
<a href="<?php echo '#'.$p_slug ?>">ここ</a>
|
86
|
+
|
75
87
|
</div>
|
76
88
|
|
77
|
-
|
89
|
+
|
78
90
|
|
79
91
|
</div>
|
80
92
|
|
81
93
|
</div>
|
82
94
|
|
83
|
-
|
84
|
-
|
85
95
|
<?php endwhile;
|
86
96
|
|
87
97
|
else:
|
@@ -118,8 +128,6 @@
|
|
118
128
|
|
119
129
|
```
|
120
130
|
|
121
|
-
|
122
|
-
|
123
131
|
single.php
|
124
132
|
|
125
133
|
```php
|
@@ -162,9 +170,157 @@
|
|
162
170
|
|
163
171
|
<div class="post-content">
|
164
172
|
|
173
|
+
<p>
|
174
|
+
|
175
|
+
<?php the_content(); ?>
|
176
|
+
|
177
|
+
</p>
|
178
|
+
|
179
|
+
|
180
|
+
|
181
|
+
</div>
|
182
|
+
|
183
|
+
</div>
|
184
|
+
|
185
|
+
|
186
|
+
|
187
|
+
<div class="navigation">
|
188
|
+
|
189
|
+
<div class="prev"><?php previous_post_link(); ?></div>
|
190
|
+
|
191
|
+
<div class="next"><?php next_post_link(); ?></div>
|
192
|
+
|
193
|
+
</div>
|
194
|
+
|
195
|
+
|
196
|
+
|
197
|
+
<?php endwhile;
|
198
|
+
|
199
|
+
else:
|
200
|
+
|
201
|
+
?>
|
202
|
+
|
203
|
+
|
204
|
+
|
205
|
+
<p>記事はありません!</p>
|
206
|
+
|
207
|
+
|
208
|
+
|
209
|
+
<?php endif;
|
210
|
+
|
211
|
+
?>
|
212
|
+
|
213
|
+
|
214
|
+
|
215
|
+
</div><!--/posts-->
|
216
|
+
|
217
|
+
<?php get_sidebar(); ?>
|
218
|
+
|
219
|
+
</div><!--/main -->
|
220
|
+
|
221
|
+
<?php get_footer(); ?>
|
222
|
+
|
223
|
+
```
|
224
|
+
|
225
|
+
sidebar.php
|
226
|
+
|
227
|
+
```php
|
228
|
+
|
229
|
+
<div id="sidebar">
|
230
|
+
|
231
|
+
<?php dynamic_sidebar(); ?>
|
232
|
+
|
233
|
+
</div><!--/sidebar-->
|
234
|
+
|
235
|
+
```
|
236
|
+
|
237
|
+
header.php
|
238
|
+
|
239
|
+
```php
|
240
|
+
|
241
|
+
<!DOCTYPE html>
|
242
|
+
|
243
|
+
<html lang="ja">
|
244
|
+
|
245
|
+
<head>
|
246
|
+
|
247
|
+
<meta charset="UTF-8">
|
248
|
+
|
249
|
+
<title><?php wp_title('|', true, 'right'); bloginfo('name'); ?></title>
|
250
|
+
|
251
|
+
<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/3.18.1/build/cssreset/cssreset-min.css">
|
252
|
+
|
253
|
+
<link rel="stylesheet" type="text/css" href="<?php echo get_stylesheet_uri(); ?>">
|
254
|
+
|
255
|
+
<?php wp_head(); ?>
|
256
|
+
|
257
|
+
</head>
|
258
|
+
|
259
|
+
<body>
|
260
|
+
|
261
|
+
<?php if(is_front_page()) { if (get_header_image() !='') { ?>
|
262
|
+
|
263
|
+
<div id="main_image">
|
264
|
+
|
265
|
+
<img src="<?php header_image(); ?>" alt="" title="" />
|
266
|
+
|
267
|
+
</div>
|
268
|
+
|
269
|
+
<?php }; }; ?>
|
270
|
+
|
271
|
+
<div id="header" class="container">
|
272
|
+
|
273
|
+
<h1><a href="<?php echo home_url('/'); ?>"><?php bloginfo('name');?></a></h1>
|
274
|
+
|
275
|
+
<div class="wrapper"><?php wp_nav_menu(); ?></div>
|
276
|
+
|
277
|
+
</div><!--/header-->
|
278
|
+
|
279
|
+
|
280
|
+
|
281
|
+
```
|
282
|
+
|
283
|
+
page.php
|
284
|
+
|
285
|
+
```php
|
286
|
+
|
287
|
+
<?php get_header(); ?>
|
288
|
+
|
289
|
+
<div id="main" class="container">
|
290
|
+
|
291
|
+
<div id="posts">
|
292
|
+
|
293
|
+
|
294
|
+
|
295
|
+
<?php if(have_posts()):
|
296
|
+
|
297
|
+
while(have_posts()):
|
298
|
+
|
299
|
+
the_post();
|
300
|
+
|
301
|
+
|
302
|
+
|
303
|
+
?>
|
304
|
+
|
305
|
+
<div class="post">
|
306
|
+
|
307
|
+
<div class="post-header">
|
308
|
+
|
309
|
+
<h2>
|
310
|
+
|
311
|
+
<a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
|
312
|
+
|
313
|
+
</h2>
|
314
|
+
|
315
|
+
</div>
|
316
|
+
|
317
|
+
|
318
|
+
|
319
|
+
<div class="post-content">
|
320
|
+
|
165
321
|
<?php the_content(); ?>
|
166
322
|
|
167
|
-
|
323
|
+
|
168
324
|
|
169
325
|
</div>
|
170
326
|
|
@@ -172,16 +328,6 @@
|
|
172
328
|
|
173
329
|
|
174
330
|
|
175
|
-
<div class="navigation">
|
176
|
-
|
177
|
-
<div class="prev"><?php previous_post_link(); ?></div>
|
178
|
-
|
179
|
-
<div class="next"><?php next_post_link(); ?></div>
|
180
|
-
|
181
|
-
</div>
|
182
|
-
|
183
|
-
|
184
|
-
|
185
331
|
<?php endwhile;
|
186
332
|
|
187
333
|
else:
|
@@ -190,7 +336,7 @@
|
|
190
336
|
|
191
337
|
|
192
338
|
|
193
|
-
<p>
|
339
|
+
<p>ページはありません!</p>
|
194
340
|
|
195
341
|
|
196
342
|
|
@@ -210,6 +356,26 @@
|
|
210
356
|
|
211
357
|
```
|
212
358
|
|
359
|
+
footer.php
|
360
|
+
|
361
|
+
```php
|
362
|
+
|
363
|
+
<div id="footer" class="container">
|
364
|
+
|
365
|
+
Copyright 2017<?php if(date("Y")!=2017) echo date("-Y"); ?> All right reserved, gomatan1258
|
366
|
+
|
367
|
+
</div><!--/footer-->
|
368
|
+
|
369
|
+
<?php wp_footer(); ?>
|
370
|
+
|
371
|
+
|
372
|
+
|
373
|
+
</body>
|
374
|
+
|
375
|
+
</html>
|
376
|
+
|
377
|
+
```
|
378
|
+
|
213
379
|
functions.php
|
214
380
|
|
215
381
|
```php
|
@@ -254,116 +420,8 @@
|
|
254
420
|
|
255
421
|
|
256
422
|
|
257
|
-
function wbsExistPost($type, $slug) {
|
258
|
-
|
259
|
-
$loops= new wp_query();
|
260
|
-
|
261
|
-
$loops->query("post_type={$type}&name={$slug}");
|
262
|
-
|
263
|
-
if($loops->have_posts()) {
|
264
|
-
|
265
|
-
echo is_search() ;
|
266
|
-
|
267
|
-
return true;
|
268
|
-
|
269
|
-
} else {
|
270
|
-
|
271
|
-
return false;
|
272
|
-
|
273
|
-
}
|
274
|
-
|
275
|
-
}
|
276
|
-
|
277
|
-
|
278
|
-
|
279
423
|
?>
|
280
424
|
|
281
425
|
```
|
282
426
|
|
283
|
-
footer.php
|
284
|
-
|
285
|
-
```php
|
286
|
-
|
287
|
-
<div id="footer" class="container">
|
288
|
-
|
289
|
-
Copyright 2017<?php if(date("Y")!=2017) echo date("-Y"); ?> All right reserved, gomatan1258
|
290
|
-
|
291
|
-
</div><!--/footer-->
|
292
|
-
|
293
|
-
<?php wp_footer(); ?>
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
</body>
|
298
|
-
|
299
|
-
</html>
|
300
|
-
|
301
|
-
```
|
302
|
-
|
303
|
-
header.php
|
304
|
-
|
305
|
-
```php
|
306
|
-
|
307
|
-
<!DOCTYPE html>
|
308
|
-
|
309
|
-
<html lang="ja">
|
310
|
-
|
311
|
-
<head>
|
312
|
-
|
313
|
-
<meta charset="UTF-8">
|
314
|
-
|
315
|
-
<title><?php wp_title('|', true, 'right'); bloginfo('name'); ?></title>
|
316
|
-
|
317
|
-
<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/3.18.1/build/cssreset/cssreset-min.css">
|
318
|
-
|
319
|
-
<link rel="stylesheet" type="text/css" href="<?php echo get_stylesheet_uri(); ?>">
|
320
|
-
|
321
|
-
<?php wp_head(); ?>
|
322
|
-
|
323
|
-
</head>
|
324
|
-
|
325
|
-
<body>
|
326
|
-
|
327
|
-
<div id="main_image">
|
328
|
-
|
329
|
-
<img src="<?php header_image(); ?>" alt="" title="" />
|
330
|
-
|
331
|
-
</div>
|
332
|
-
|
333
|
-
<div id="header" class="container">
|
334
|
-
|
335
|
-
<h1><a href="<?php echo home_url('/'); ?>"><?php bloginfo('name');?></a></h1>
|
336
|
-
|
337
|
-
<div class="wrapper"><?php wp_nav_menu(); ?></div>
|
338
|
-
|
339
|
-
</div><!--/header-->
|
340
|
-
|
341
|
-
```
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
427
|
+
当方はワードプレス初心者ですがよろしくお願いします。
|
346
|
-
|
347
|
-
phpも入ってます。
|
348
|
-
|
349
|
-
```javascript
|
350
|
-
|
351
|
-
console.log("<?php
|
352
|
-
|
353
|
-
$paged = get_query_var( 'future-financial' );
|
354
|
-
|
355
|
-
if ( is_paged()) {
|
356
|
-
|
357
|
-
echo $paged.'ページ目';
|
358
|
-
|
359
|
-
} else {
|
360
|
-
|
361
|
-
echo '1ページ目';
|
362
|
-
|
363
|
-
}
|
364
|
-
|
365
|
-
?>");
|
366
|
-
|
367
|
-
```
|
368
|
-
|
369
|
-
です。申し訳ございません。
|
3
修正依頼があったため
test
CHANGED
File without changes
|
test
CHANGED
@@ -343,3 +343,27 @@
|
|
343
343
|
|
344
344
|
|
345
345
|
申し訳ございません。ワードプレス初心者で、質問の仕方が下手くそでした。
|
346
|
+
|
347
|
+
phpも入ってます。
|
348
|
+
|
349
|
+
```javascript
|
350
|
+
|
351
|
+
console.log("<?php
|
352
|
+
|
353
|
+
$paged = get_query_var( 'future-financial' );
|
354
|
+
|
355
|
+
if ( is_paged()) {
|
356
|
+
|
357
|
+
echo $paged.'ページ目';
|
358
|
+
|
359
|
+
} else {
|
360
|
+
|
361
|
+
echo '1ページ目';
|
362
|
+
|
363
|
+
}
|
364
|
+
|
365
|
+
?>");
|
366
|
+
|
367
|
+
```
|
368
|
+
|
369
|
+
です。申し訳ございません。
|
2
失礼があったため
test
CHANGED
File without changes
|
test
CHANGED
@@ -339,3 +339,7 @@
|
|
339
339
|
</div><!--/header-->
|
340
340
|
|
341
341
|
```
|
342
|
+
|
343
|
+
|
344
|
+
|
345
|
+
申し訳ございません。ワードプレス初心者で、質問の仕方が下手くそでした。
|
1
わからない質問だったのでコードを書きました
test
CHANGED
File without changes
|
test
CHANGED
@@ -1 +1,341 @@
|
|
1
1
|
ワードプレスで記事を書きますが、1~3ページくらいあるとして、eggというスラッグがあったとして、そのページが1~3ページのどこあるかをゲットした数値を出せる関数がほしいです。例えば2ページ目にあったら2と返すようにしたいです。ネットで調べてもわからないので教えてください。よろしくお願いします。
|
2
|
+
|
3
|
+
|
4
|
+
|
5
|
+
index.php
|
6
|
+
|
7
|
+
```php
|
8
|
+
|
9
|
+
<?php get_header(); ?>
|
10
|
+
|
11
|
+
<div id="main" class="container">
|
12
|
+
|
13
|
+
<div id="posts">
|
14
|
+
|
15
|
+
|
16
|
+
|
17
|
+
<?php if(have_posts()):
|
18
|
+
|
19
|
+
while(have_posts()):
|
20
|
+
|
21
|
+
the_post();
|
22
|
+
|
23
|
+
|
24
|
+
|
25
|
+
?>
|
26
|
+
|
27
|
+
<div class="post">
|
28
|
+
|
29
|
+
<div class="post-header">
|
30
|
+
|
31
|
+
<h2>
|
32
|
+
|
33
|
+
<a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
|
34
|
+
|
35
|
+
</h2>
|
36
|
+
|
37
|
+
</div>
|
38
|
+
|
39
|
+
<div class="post-meta">
|
40
|
+
|
41
|
+
<?php echo get_the_date(); ?> 【<?php the_category(', ') ?>】
|
42
|
+
|
43
|
+
</div>
|
44
|
+
|
45
|
+
<div class="post-content">
|
46
|
+
|
47
|
+
<div class="post-image">
|
48
|
+
|
49
|
+
|
50
|
+
|
51
|
+
<?php if(has_post_thumbnail()): ?>
|
52
|
+
|
53
|
+
<?php the_post_thumbnail(array(100, 100)); ?>
|
54
|
+
|
55
|
+
<?php else: ?>
|
56
|
+
|
57
|
+
<img src="<?php echo get_template_directory_uri(); ?>/images.jpg" width="100" height="100">
|
58
|
+
|
59
|
+
<?php endif; ?>
|
60
|
+
|
61
|
+
|
62
|
+
|
63
|
+
</div>
|
64
|
+
|
65
|
+
<div class="post-body">
|
66
|
+
|
67
|
+
<div class="post-body-excerpt">
|
68
|
+
|
69
|
+
<?php the_content('',false,''); ?>
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
</div>
|
74
|
+
|
75
|
+
</div>
|
76
|
+
|
77
|
+
<p>index.php</p>
|
78
|
+
|
79
|
+
</div>
|
80
|
+
|
81
|
+
</div>
|
82
|
+
|
83
|
+
|
84
|
+
|
85
|
+
<?php endwhile;
|
86
|
+
|
87
|
+
else:
|
88
|
+
|
89
|
+
?>
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
<p>記事はありません!</p>
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
<?php endif;
|
98
|
+
|
99
|
+
?>
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
<div class="navigation">
|
104
|
+
|
105
|
+
<div class="prev"><?php previous_posts_link(); ?></div>
|
106
|
+
|
107
|
+
<div class="next"><?php next_posts_link(); ?></div>
|
108
|
+
|
109
|
+
</div>
|
110
|
+
|
111
|
+
</div><!--/posts-->
|
112
|
+
|
113
|
+
<?php get_sidebar(); ?>
|
114
|
+
|
115
|
+
</div><!--/main -->
|
116
|
+
|
117
|
+
<?php get_footer(); ?>
|
118
|
+
|
119
|
+
```
|
120
|
+
|
121
|
+
|
122
|
+
|
123
|
+
single.php
|
124
|
+
|
125
|
+
```php
|
126
|
+
|
127
|
+
<?php get_header(); ?>
|
128
|
+
|
129
|
+
<div id="main" class="container">
|
130
|
+
|
131
|
+
<div id="posts">
|
132
|
+
|
133
|
+
|
134
|
+
|
135
|
+
<?php if(have_posts()):
|
136
|
+
|
137
|
+
while(have_posts()):
|
138
|
+
|
139
|
+
the_post();
|
140
|
+
|
141
|
+
|
142
|
+
|
143
|
+
?>
|
144
|
+
|
145
|
+
<div class="post">
|
146
|
+
|
147
|
+
<div class="post-header">
|
148
|
+
|
149
|
+
<h2>
|
150
|
+
|
151
|
+
<a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
|
152
|
+
|
153
|
+
</h2>
|
154
|
+
|
155
|
+
</div>
|
156
|
+
|
157
|
+
<div class="post-meta">
|
158
|
+
|
159
|
+
<?php echo get_the_date(); ?> 【<?php the_category(', ') ?>】
|
160
|
+
|
161
|
+
</div>
|
162
|
+
|
163
|
+
<div class="post-content">
|
164
|
+
|
165
|
+
<?php the_content(); ?>
|
166
|
+
|
167
|
+
<P>single.php</P>
|
168
|
+
|
169
|
+
</div>
|
170
|
+
|
171
|
+
</div>
|
172
|
+
|
173
|
+
|
174
|
+
|
175
|
+
<div class="navigation">
|
176
|
+
|
177
|
+
<div class="prev"><?php previous_post_link(); ?></div>
|
178
|
+
|
179
|
+
<div class="next"><?php next_post_link(); ?></div>
|
180
|
+
|
181
|
+
</div>
|
182
|
+
|
183
|
+
|
184
|
+
|
185
|
+
<?php endwhile;
|
186
|
+
|
187
|
+
else:
|
188
|
+
|
189
|
+
?>
|
190
|
+
|
191
|
+
|
192
|
+
|
193
|
+
<p>記事はありません!</p>
|
194
|
+
|
195
|
+
|
196
|
+
|
197
|
+
<?php endif;
|
198
|
+
|
199
|
+
?>
|
200
|
+
|
201
|
+
|
202
|
+
|
203
|
+
</div><!--/posts-->
|
204
|
+
|
205
|
+
<?php get_sidebar(); ?>
|
206
|
+
|
207
|
+
</div><!--/main -->
|
208
|
+
|
209
|
+
<?php get_footer(); ?>
|
210
|
+
|
211
|
+
```
|
212
|
+
|
213
|
+
functions.php
|
214
|
+
|
215
|
+
```php
|
216
|
+
|
217
|
+
<?php
|
218
|
+
|
219
|
+
|
220
|
+
|
221
|
+
add_theme_support( 'custom-header' );
|
222
|
+
|
223
|
+
|
224
|
+
|
225
|
+
add_theme_support('menus');
|
226
|
+
|
227
|
+
|
228
|
+
|
229
|
+
register_sidebar(
|
230
|
+
|
231
|
+
array(
|
232
|
+
|
233
|
+
before_widget => '<div class="widget">',
|
234
|
+
|
235
|
+
after_widget => '</div>',
|
236
|
+
|
237
|
+
before_title => '<h3>',
|
238
|
+
|
239
|
+
after_title => '</h3>',
|
240
|
+
|
241
|
+
)
|
242
|
+
|
243
|
+
);
|
244
|
+
|
245
|
+
|
246
|
+
|
247
|
+
add_theme_support('post-thumbnails');
|
248
|
+
|
249
|
+
|
250
|
+
|
251
|
+
$cssdir = get_stylesheet_directory_uri();
|
252
|
+
|
253
|
+
wp_enqueue_script( 'theme-script', $cssdir.'/script.php', array('jquery'));
|
254
|
+
|
255
|
+
|
256
|
+
|
257
|
+
function wbsExistPost($type, $slug) {
|
258
|
+
|
259
|
+
$loops= new wp_query();
|
260
|
+
|
261
|
+
$loops->query("post_type={$type}&name={$slug}");
|
262
|
+
|
263
|
+
if($loops->have_posts()) {
|
264
|
+
|
265
|
+
echo is_search() ;
|
266
|
+
|
267
|
+
return true;
|
268
|
+
|
269
|
+
} else {
|
270
|
+
|
271
|
+
return false;
|
272
|
+
|
273
|
+
}
|
274
|
+
|
275
|
+
}
|
276
|
+
|
277
|
+
|
278
|
+
|
279
|
+
?>
|
280
|
+
|
281
|
+
```
|
282
|
+
|
283
|
+
footer.php
|
284
|
+
|
285
|
+
```php
|
286
|
+
|
287
|
+
<div id="footer" class="container">
|
288
|
+
|
289
|
+
Copyright 2017<?php if(date("Y")!=2017) echo date("-Y"); ?> All right reserved, gomatan1258
|
290
|
+
|
291
|
+
</div><!--/footer-->
|
292
|
+
|
293
|
+
<?php wp_footer(); ?>
|
294
|
+
|
295
|
+
|
296
|
+
|
297
|
+
</body>
|
298
|
+
|
299
|
+
</html>
|
300
|
+
|
301
|
+
```
|
302
|
+
|
303
|
+
header.php
|
304
|
+
|
305
|
+
```php
|
306
|
+
|
307
|
+
<!DOCTYPE html>
|
308
|
+
|
309
|
+
<html lang="ja">
|
310
|
+
|
311
|
+
<head>
|
312
|
+
|
313
|
+
<meta charset="UTF-8">
|
314
|
+
|
315
|
+
<title><?php wp_title('|', true, 'right'); bloginfo('name'); ?></title>
|
316
|
+
|
317
|
+
<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/3.18.1/build/cssreset/cssreset-min.css">
|
318
|
+
|
319
|
+
<link rel="stylesheet" type="text/css" href="<?php echo get_stylesheet_uri(); ?>">
|
320
|
+
|
321
|
+
<?php wp_head(); ?>
|
322
|
+
|
323
|
+
</head>
|
324
|
+
|
325
|
+
<body>
|
326
|
+
|
327
|
+
<div id="main_image">
|
328
|
+
|
329
|
+
<img src="<?php header_image(); ?>" alt="" title="" />
|
330
|
+
|
331
|
+
</div>
|
332
|
+
|
333
|
+
<div id="header" class="container">
|
334
|
+
|
335
|
+
<h1><a href="<?php echo home_url('/'); ?>"><?php bloginfo('name');?></a></h1>
|
336
|
+
|
337
|
+
<div class="wrapper"><?php wp_nav_menu(); ?></div>
|
338
|
+
|
339
|
+
</div><!--/header-->
|
340
|
+
|
341
|
+
```
|