質問編集履歴
2
変更
test
CHANGED
File without changes
|
test
CHANGED
@@ -60,7 +60,7 @@
|
|
60
60
|
|
61
61
|
<div class="shareBox">
|
62
62
|
|
63
|
-
<div class="twBox"><a href="https://twitter.com/share?ref_src=twsrc%5Etfw" class="twitter-share-button" data-show-count="false">Tweet</a><script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script></div><div class="fb-share-button" data-href="http://
|
63
|
+
<div class="twBox"><a href="https://twitter.com/share?ref_src=twsrc%5Etfw" class="twitter-share-button" data-show-count="false">Tweet</a><script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script></div><div class="fb-share-button" data-href="http://aaaaaaa.jp/" data-layout="button_count" data-size="small" data-mobile-iframe="true"><a target="_blank" href="https://www.facebook.com/sharer/sharer.php?u=http%3A%2F%2Faaaaaaa.jp%2F&src=sdkpreparse" class="fb-xfbml-parse-ignore">シェア</a></div>
|
64
64
|
|
65
65
|
</div>
|
66
66
|
|
1
追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -14,6 +14,318 @@
|
|
14
14
|
|
15
15
|
|
16
16
|
|
17
|
+
「コード」
|
18
|
+
|
19
|
+
```ここに言語を入力
|
20
|
+
|
21
|
+
<!-- postBox -->
|
22
|
+
|
23
|
+
<section id="postBox">
|
24
|
+
|
25
|
+
<!-- newPostBox -->
|
26
|
+
|
27
|
+
<div class="newPostBox cleaefix">
|
28
|
+
|
29
|
+
|
30
|
+
|
31
|
+
<?php if(have_posts()): while(have_posts()): the_post(); ?>
|
32
|
+
|
33
|
+
<p class="date"><?php the_author(); ?> <?php echo get_the_date(); ?></p>
|
34
|
+
|
35
|
+
<h2 class="title"><?php the_title(); ?></h2>
|
36
|
+
|
37
|
+
<?php the_content(); ?>
|
38
|
+
|
39
|
+
<?php endwhile; endif; ?>
|
40
|
+
|
41
|
+
|
42
|
+
|
43
|
+
<!-- facebook-->
|
44
|
+
|
45
|
+
<script>(function(d, s, id) {
|
46
|
+
|
47
|
+
var js, fjs = d.getElementsByTagName(s)[0];
|
48
|
+
|
49
|
+
if (d.getElementById(id)) return;
|
50
|
+
|
51
|
+
js = d.createElement(s); js.id = id;
|
52
|
+
|
53
|
+
js.src = 'https://connect.facebook.net/ja_JP/sdk.js#xfbml=1&version=v3.1';
|
54
|
+
|
55
|
+
fjs.parentNode.insertBefore(js, fjs);
|
56
|
+
|
57
|
+
}(document, 'script', 'facebook-jssdk'));</script>
|
58
|
+
|
59
|
+
<!-- shareBox -->
|
60
|
+
|
61
|
+
<div class="shareBox">
|
62
|
+
|
63
|
+
<div class="twBox"><a href="https://twitter.com/share?ref_src=twsrc%5Etfw" class="twitter-share-button" data-show-count="false">Tweet</a><script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script></div><div class="fb-share-button" data-href="http://tokyo-times.jp/" data-layout="button_count" data-size="small" data-mobile-iframe="true"><a target="_blank" href="https://www.facebook.com/sharer/sharer.php?u=http%3A%2F%2Ftokyo-times.jp%2F&src=sdkpreparse" class="fb-xfbml-parse-ignore">シェア</a></div>
|
64
|
+
|
65
|
+
</div>
|
66
|
+
|
67
|
+
<!-- shareBox -->
|
68
|
+
|
69
|
+
|
70
|
+
|
71
|
+
<!-- relationBox -->
|
72
|
+
|
73
|
+
<div class="relationBox">
|
74
|
+
|
75
|
+
<p class="pickTitle">関連記事</p>
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
<?php
|
80
|
+
|
81
|
+
// カテゴリーが複数設定されている場合は、どれかをランダムに取得
|
82
|
+
|
83
|
+
$categories = wp_get_post_categories($post->ID, array('orderby'=>'rand'));
|
84
|
+
|
85
|
+
//表示したい記事要素を設定
|
86
|
+
|
87
|
+
if ($categories) {
|
88
|
+
|
89
|
+
$args = array(
|
90
|
+
|
91
|
+
'category__in' => array($categories[0]), // カテゴリーのIDで記事を取得
|
92
|
+
|
93
|
+
'post__not_in' => array($post->ID), // 表示している記事は除外する
|
94
|
+
|
95
|
+
'showposts'=>3, // 取得したい記事数
|
96
|
+
|
97
|
+
'caller_get_posts'=>1, // 取得した記事を1番目から表示する
|
98
|
+
|
99
|
+
'orderby'=> 'rand' // ランダムで取得する
|
100
|
+
|
101
|
+
);
|
102
|
+
|
103
|
+
$my_query = new WP_Query($args);
|
104
|
+
|
105
|
+
if( $my_query->have_posts() ) {
|
106
|
+
|
107
|
+
while ($my_query->have_posts()) { $my_query->the_post();
|
108
|
+
|
109
|
+
?>
|
110
|
+
|
111
|
+
<!-- imgTextBox -->
|
112
|
+
|
113
|
+
<div class="imgTextBox">
|
114
|
+
|
115
|
+
<?php
|
116
|
+
|
117
|
+
$cat = get_the_category();
|
118
|
+
|
119
|
+
$cat_slug = $cat[0]->slug;
|
120
|
+
|
121
|
+
$cat_name = $cat[0]->name;
|
122
|
+
|
123
|
+
?>
|
124
|
+
|
125
|
+
<p class="textP"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a><br><span class="postDate"><?php echo get_the_date( $format, $post ); ?></span><span class="writeName"><?php the_author(); ?></span><span class="catName"><?php echo $cat_name; ?></span></p>
|
126
|
+
|
127
|
+
<p class="imgP"><a href="<?php the_permalink(); ?>"><?php the_post_thumbnail('thumbnail'); ?></a></p>
|
128
|
+
|
129
|
+
</div>
|
130
|
+
|
131
|
+
<!-- imgTextBox -->
|
132
|
+
|
133
|
+
<?php } wp_reset_query();
|
134
|
+
|
135
|
+
} else { ?>
|
136
|
+
|
137
|
+
<p class="no-related">関連記事がありません。</p>
|
138
|
+
|
139
|
+
<?php } } ?>
|
140
|
+
|
141
|
+
|
142
|
+
|
143
|
+
</div>
|
144
|
+
|
145
|
+
<!-- relationBox -->
|
146
|
+
|
147
|
+
|
148
|
+
|
149
|
+
</div>
|
150
|
+
|
151
|
+
<!-- newPostBox -->
|
152
|
+
|
153
|
+
|
154
|
+
|
155
|
+
<!-- otherPostBox -->
|
156
|
+
|
157
|
+
<section id="otherPostBox">
|
158
|
+
|
159
|
+
|
160
|
+
|
161
|
+
<!-- rankPostBox -->
|
162
|
+
|
163
|
+
<div class="rankPostBox">
|
164
|
+
|
165
|
+
<p class="title-s">総合ランキング</p>
|
166
|
+
|
167
|
+
<?php
|
168
|
+
|
169
|
+
if (function_exists('wpp_get_mostpopular')) {
|
170
|
+
|
171
|
+
$arg = array (
|
172
|
+
|
173
|
+
'range' => 'all',//集計する期間(weekly,monthly,all)
|
174
|
+
|
175
|
+
'order_by' => 'views',//閲覧数で集計(comments(コメント数で集計),avg(1日の平均で集計))
|
176
|
+
|
177
|
+
'post_type' => 'post',//ポストタイプを指定(post,page,カスタムポスト名)
|
178
|
+
|
179
|
+
'title_length' => '35',//表示させるタイトル文字数
|
180
|
+
|
181
|
+
'excerpt_length' => '0',//抜粋文字数
|
182
|
+
|
183
|
+
'stats_comments' => '0',//コメント数表示(1 or 0)
|
184
|
+
|
185
|
+
'limit' => 5, //表示数
|
186
|
+
|
187
|
+
'stats_views' => '0',//閲覧数表示(1 or 0)
|
188
|
+
|
189
|
+
'thumbnail_width' => '75',//サムネイルの幅
|
190
|
+
|
191
|
+
'thumbnail_height' => '75',//サムネイルの高さ
|
192
|
+
|
193
|
+
'post_html' => '<div class="postBox"><ul><li>{thumb}</li></ul><p>{title}</p></div>'//表示されるhtmlの設定({thumb}はリンク付きのサムネイル画像,{title}はリンク付きのタイトル,{summary}は抜粋文)
|
194
|
+
|
195
|
+
);
|
196
|
+
|
197
|
+
wpp_get_mostpopular($arg);//リストが出力される。
|
198
|
+
|
199
|
+
}
|
200
|
+
|
201
|
+
|
202
|
+
|
203
|
+
?>
|
204
|
+
|
205
|
+
|
206
|
+
|
207
|
+
<!-- ad1Box -->
|
208
|
+
|
209
|
+
<div class="ad1Box">
|
210
|
+
|
211
|
+
</div>
|
212
|
+
|
213
|
+
<!-- ad1Box -->
|
214
|
+
|
215
|
+
|
216
|
+
|
217
|
+
<p class="title-w">週間ランキング</p>
|
218
|
+
|
219
|
+
<?php
|
220
|
+
|
221
|
+
if (function_exists('wpp_get_mostpopular')) {
|
222
|
+
|
223
|
+
$arg = array (
|
224
|
+
|
225
|
+
'range' => 'weekly',//集計する期間(weekly,monthly,all)
|
226
|
+
|
227
|
+
'order_by' => 'views',//閲覧数で集計(comments(コメント数で集計),avg(1日の平均で集計))
|
228
|
+
|
229
|
+
'post_type' => 'post',//ポストタイプを指定(post,page,カスタムポスト名)
|
230
|
+
|
231
|
+
'title_length' => '35',//表示させるタイトル文字数
|
232
|
+
|
233
|
+
'excerpt_length' => '0',//抜粋文字数
|
234
|
+
|
235
|
+
'stats_comments' => '0',//コメント数表示(1 or 0)
|
236
|
+
|
237
|
+
'limit' => 10, //表示数
|
238
|
+
|
239
|
+
'stats_views' => '0',//閲覧数表示(1 or 0)
|
240
|
+
|
241
|
+
'thumbnail_width' => '75',//サムネイルの幅
|
242
|
+
|
243
|
+
'thumbnail_height' => '75',//サムネイルの高さ
|
244
|
+
|
245
|
+
'post_html' => '<div class="postBox"><ul><li>{thumb}</li></ul><p>{title}</p></div>'//表示されるhtmlの設定({thumb}はリンク付きのサムネイル画像,{title}はリンク付きのタイトル,{summary}は抜粋文)
|
246
|
+
|
247
|
+
);
|
248
|
+
|
249
|
+
wpp_get_mostpopular($arg);//リストが出力される。
|
250
|
+
|
251
|
+
}
|
252
|
+
|
253
|
+
|
254
|
+
|
255
|
+
?>
|
256
|
+
|
257
|
+
|
258
|
+
|
259
|
+
<!-- ad1Box -->
|
260
|
+
|
261
|
+
<div class="ad1Box">
|
262
|
+
|
263
|
+
</div>
|
264
|
+
|
265
|
+
<!-- ad1Box -->
|
266
|
+
|
267
|
+
|
268
|
+
|
269
|
+
<p class="title-m">月間ランキング</p>
|
270
|
+
|
271
|
+
<?php
|
272
|
+
|
273
|
+
if (function_exists('wpp_get_mostpopular')) {
|
274
|
+
|
275
|
+
$arg = array (
|
276
|
+
|
277
|
+
'range' => 'monthly',//集計する期間(weekly,monthly,all)
|
278
|
+
|
279
|
+
'order_by' => 'views',//閲覧数で集計(comments(コメント数で集計),avg(1日の平均で集計))
|
280
|
+
|
281
|
+
'post_type' => 'post',//ポストタイプを指定(post,page,カスタムポスト名)
|
282
|
+
|
283
|
+
'title_length' => '35',//表示させるタイトル文字数
|
284
|
+
|
285
|
+
'excerpt_length' => '0',//抜粋文字数
|
286
|
+
|
287
|
+
'stats_comments' => '0',//コメント数表示(1 or 0)
|
288
|
+
|
289
|
+
'limit' => 10, //表示数
|
290
|
+
|
291
|
+
'stats_views' => '0',//閲覧数表示(1 or 0)
|
292
|
+
|
293
|
+
'thumbnail_width' => '75',//サムネイルの幅
|
294
|
+
|
295
|
+
'thumbnail_height' => '75',//サムネイルの高さ
|
296
|
+
|
297
|
+
'post_html' => '<div class="postBox"><ul><li>{thumb}</li></ul><p>{title}</p></div>'//表示されるhtmlの設定({thumb}はリンク付きのサムネイル画像,{title}はリンク付きのタイトル,{summary}は抜粋文)
|
298
|
+
|
299
|
+
);
|
300
|
+
|
301
|
+
wpp_get_mostpopular($arg);//リストが出力される。
|
302
|
+
|
303
|
+
}
|
304
|
+
|
305
|
+
|
306
|
+
|
307
|
+
?>
|
308
|
+
|
309
|
+
</div>
|
310
|
+
|
311
|
+
<!-- rankPostBox -->
|
312
|
+
|
313
|
+
|
314
|
+
|
315
|
+
</section>
|
316
|
+
|
317
|
+
<!-- otherPostBox -->
|
318
|
+
|
319
|
+
</section>
|
320
|
+
|
321
|
+
<!-- postBox -->
|
322
|
+
|
323
|
+
```
|
324
|
+
|
325
|
+
|
326
|
+
|
327
|
+
|
328
|
+
|
17
329
|
「試したこと」
|
18
330
|
|
19
331
|
---
|