質問編集履歴
1
コードの追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -55,3 +55,263 @@
|
|
55
55
|
|
56
56
|
|
57
57
|
もし、改善できる可能性のある案をお持ちの方はどんな情報でも構いませんのでよろしくお願いします。
|
58
|
+
|
59
|
+
|
60
|
+
|
61
|
+
|
62
|
+
|
63
|
+
###追記
|
64
|
+
|
65
|
+
single.phpです
|
66
|
+
|
67
|
+
```PHP
|
68
|
+
|
69
|
+
<?php get_header(); ?>
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
<div class="sub-header">
|
74
|
+
|
75
|
+
<!--<div class="bread">
|
76
|
+
|
77
|
+
<ol>
|
78
|
+
|
79
|
+
<li ><a href="<?php echo home_url(); ?>">
|
80
|
+
|
81
|
+
<i class="fa fa-home"></i><span>TOP</span>
|
82
|
+
|
83
|
+
</a></li>
|
84
|
+
|
85
|
+
|
86
|
+
|
87
|
+
<li>
|
88
|
+
|
89
|
+
<?php if( has_category() ): ?>
|
90
|
+
|
91
|
+
<?php $postcat=get_the_category(); ?>
|
92
|
+
|
93
|
+
<?php echo get_category_parents( $postcat[0], true, '</li><li>' ); ?>
|
94
|
+
|
95
|
+
<?php endif; ?>
|
96
|
+
|
97
|
+
<a><?php the_title(); ?></a>
|
98
|
+
|
99
|
+
</li>
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
</ol>
|
104
|
+
|
105
|
+
</div> -->
|
106
|
+
|
107
|
+
<div class="breadcrumbs">
|
108
|
+
|
109
|
+
<?php if(function_exists('bcn_display'))
|
110
|
+
|
111
|
+
{
|
112
|
+
|
113
|
+
bcn_display();
|
114
|
+
|
115
|
+
}?>
|
116
|
+
|
117
|
+
</div>
|
118
|
+
|
119
|
+
</div>
|
120
|
+
|
121
|
+
|
122
|
+
|
123
|
+
|
124
|
+
|
125
|
+
|
126
|
+
|
127
|
+
<div class="container">
|
128
|
+
|
129
|
+
<div class="contents">
|
130
|
+
|
131
|
+
<?php if(have_posts()): while(have_posts()):
|
132
|
+
|
133
|
+
the_post(); ?>
|
134
|
+
|
135
|
+
<article <?php post_class( 'kiji' ); ?>>
|
136
|
+
|
137
|
+
|
138
|
+
|
139
|
+
<div class="kiji-tag">
|
140
|
+
|
141
|
+
<?php the_tags( '<ul><li>', '</li><li>', '</li></ul>' ); ?>
|
142
|
+
|
143
|
+
</div>
|
144
|
+
|
145
|
+
|
146
|
+
|
147
|
+
<h1 id="pagetitle"><?php the_title(); ?></h1>
|
148
|
+
|
149
|
+
|
150
|
+
|
151
|
+
|
152
|
+
|
153
|
+
|
154
|
+
|
155
|
+
<?php the_content(); ?>
|
156
|
+
|
157
|
+
|
158
|
+
|
159
|
+
<?php wp_link_pages( array(
|
160
|
+
|
161
|
+
'before' => '<div class="pagination"><ul><li>',
|
162
|
+
|
163
|
+
'separator' => '</li><li>',
|
164
|
+
|
165
|
+
'after' => '</li></ul></div>',
|
166
|
+
|
167
|
+
'pagelink' => '<span>%</span>'
|
168
|
+
|
169
|
+
) ); ?>
|
170
|
+
|
171
|
+
|
172
|
+
|
173
|
+
|
174
|
+
|
175
|
+
<?php if( has_category() ) {
|
176
|
+
|
177
|
+
$cats = get_the_category();
|
178
|
+
|
179
|
+
$catkwds = array();
|
180
|
+
|
181
|
+
foreach($cats as $cat) {
|
182
|
+
|
183
|
+
$catkwds[] = $cat->term_id;
|
184
|
+
|
185
|
+
}
|
186
|
+
|
187
|
+
} ?>
|
188
|
+
|
189
|
+
<?php
|
190
|
+
|
191
|
+
$myposts = get_posts( array(
|
192
|
+
|
193
|
+
'post_type' => 'post',
|
194
|
+
|
195
|
+
'posts_per_page' => '4',
|
196
|
+
|
197
|
+
'post__not_in' => array( $post->ID ),
|
198
|
+
|
199
|
+
'category__in' => $catkwds,
|
200
|
+
|
201
|
+
'orderby' => 'rand'
|
202
|
+
|
203
|
+
) );
|
204
|
+
|
205
|
+
if( $myposts ): ?>
|
206
|
+
|
207
|
+
|
208
|
+
|
209
|
+
<?php if ( has_category( 'service' )): ?>
|
210
|
+
|
211
|
+
<!--------------CommentArea--------------->
|
212
|
+
|
213
|
+
<div class="col-full">
|
214
|
+
|
215
|
+
<div class="wrap-col">
|
216
|
+
|
217
|
+
<?php comments_template( ); ?>
|
218
|
+
|
219
|
+
</div><!-- ^ .wrap-col END-->
|
220
|
+
|
221
|
+
</div><!-- ^ .col-full END-->
|
222
|
+
|
223
|
+
<!--------------CommentArea END--------------->
|
224
|
+
|
225
|
+
<?php endif; ?>
|
226
|
+
|
227
|
+
|
228
|
+
|
229
|
+
<aside class="mymenu mymenu-thumb mymenu-related">
|
230
|
+
|
231
|
+
<h2>関連記事</h2>
|
232
|
+
|
233
|
+
<ul>
|
234
|
+
|
235
|
+
|
236
|
+
|
237
|
+
<?php foreach($myposts as $post):
|
238
|
+
|
239
|
+
setup_postdata($post); ?>
|
240
|
+
|
241
|
+
<li><a href="<?php the_permalink(); ?>">
|
242
|
+
|
243
|
+
<div class="text">
|
244
|
+
|
245
|
+
<?php the_title(); ?>
|
246
|
+
|
247
|
+
</div>
|
248
|
+
|
249
|
+
</a></li>
|
250
|
+
|
251
|
+
<?php endforeach; ?>
|
252
|
+
|
253
|
+
|
254
|
+
|
255
|
+
</ul>
|
256
|
+
|
257
|
+
</aside>
|
258
|
+
|
259
|
+
<?php wp_reset_postdata();
|
260
|
+
|
261
|
+
endif; ?>
|
262
|
+
|
263
|
+
|
264
|
+
|
265
|
+
|
266
|
+
|
267
|
+
|
268
|
+
|
269
|
+
</article>
|
270
|
+
|
271
|
+
<?php endwhile; endif; ?>
|
272
|
+
|
273
|
+
|
274
|
+
|
275
|
+
|
276
|
+
|
277
|
+
|
278
|
+
|
279
|
+
|
280
|
+
|
281
|
+
</div>
|
282
|
+
|
283
|
+
|
284
|
+
|
285
|
+
<div class="sub">
|
286
|
+
|
287
|
+
<?php get_sidebar(); ?>
|
288
|
+
|
289
|
+
</div>
|
290
|
+
|
291
|
+
</div>
|
292
|
+
|
293
|
+
|
294
|
+
|
295
|
+
<?php get_footer(); ?>
|
296
|
+
|
297
|
+
|
298
|
+
|
299
|
+
|
300
|
+
|
301
|
+
<?php //アクセス数の記録
|
302
|
+
|
303
|
+
$count_key = 'postviews';
|
304
|
+
|
305
|
+
$count = get_post_meta($post->ID, $count_key, true);
|
306
|
+
|
307
|
+
$count++;
|
308
|
+
|
309
|
+
update_post_meta($post->ID, $count_key, $count);
|
310
|
+
|
311
|
+
?>
|
312
|
+
|
313
|
+
|
314
|
+
|
315
|
+
|
316
|
+
|
317
|
+
```
|