質問編集履歴

2

コードブロックをしました

2016/04/23 06:55

投稿

yukko
yukko

スコア21

test CHANGED
File without changes
test CHANGED
@@ -86,6 +86,8 @@
86
86
 
87
87
 
88
88
 
89
+ ```PHP
90
+
89
91
  <?php
90
92
 
91
93
  $post = $wp_query->post;
@@ -102,6 +104,8 @@
102
104
 
103
105
  ?>
104
106
 
107
+ ```
108
+
105
109
 
106
110
 
107
111
  と記述し、
@@ -122,6 +126,8 @@
122
126
 
123
127
 
124
128
 
129
+ ```php
130
+
125
131
  <?php get_header(); $options = get_lifefit_option(); ?>
126
132
 
127
133
 
@@ -394,4 +400,6 @@
394
400
 
395
401
  <?php get_footer(); ?>
396
402
 
403
+ ```
404
+
397
- -------------------------------------------------
405
+ -------------------------------------------------

1

表示周りについて更新しました

2016/04/23 06:54

投稿

yukko
yukko

スコア21

test CHANGED
File without changes
test CHANGED
@@ -75,3 +75,323 @@
75
75
  何か怪しいファイルや、表示を妨げていると思われるファイル、プラグインを教えていただけるだけでも結構です。
76
76
 
77
77
  手がかりをお願いします。
78
+
79
+ -------------------------------------------------
80
+
81
+ 追記
82
+
83
+ -------------------------------------------------
84
+
85
+ 「single.php」に
86
+
87
+
88
+
89
+ <?php
90
+
91
+ $post = $wp_query->post;
92
+
93
+ if ( in_category('特定のカテゴリーのスラッグ名') ) {
94
+
95
+ include(TEMPLATEPATH.'/特定のカテゴリー用.php');
96
+
97
+ } else {
98
+
99
+ include(TEMPLATEPATH.'/single-nomal.php');
100
+
101
+ }
102
+
103
+ ?>
104
+
105
+
106
+
107
+ と記述し、
108
+
109
+ 「single-nomal.php」は最初のsingle.phpをコピーしたもののままで「特定のカテゴリー用.php」は任意の表示ができるようにしてあります。
110
+
111
+ CSSに関してはまだ触れていない状態です。
112
+
113
+
114
+
115
+ 最初の「single.php」の段階でも、特定のカテゴリーで表示されることはありませんでした。
116
+
117
+ -------------------------------------------------
118
+
119
+
120
+
121
+ 元の「sigle.php」は下記のとおりです。
122
+
123
+
124
+
125
+ <?php get_header(); $options = get_lifefit_option(); ?>
126
+
127
+
128
+
129
+ <div id="main_content">
130
+
131
+
132
+
133
+ <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
134
+
135
+
136
+
137
+ <div id="post_header" class="clearfix">
138
+
139
+ <h2 class="title<?php if($options['layout'] == 'three_column1' || $options['layout'] == 'three_column2') { title_height3(); } else { title_height2(); }; ?>"><?php the_title(); ?></h2>
140
+
141
+ <?php if ($options['show_date']) : ?><p class="post_date"><?php the_time('m.d'); ?></p><?php endif; ?>
142
+
143
+ </div>
144
+
145
+
146
+
147
+ <div id="post_meta_top" class="clearfix">
148
+
149
+ <?php if ($options['show_author'] or $options['show_comment']) { ?>
150
+
151
+ <ul class="clearfix">
152
+
153
+ <?php if ($options['show_author']) : ?><li class="post_author"><?php the_author_posts_link(); ?></li><?php endif; ?>
154
+
155
+ <?php if ($options['show_comment']) : ?><li class="post_comment"><?php comments_popup_link(__('Write comment', 'lifefit'), __('1 comment', 'lifefit'), __('% comments', 'lifefit')); ?></li><?php endif; ?>
156
+
157
+ </ul>
158
+
159
+ <?php }; ?>
160
+
161
+ <?php edit_post_link(__('[ EDIT ]', 'lifefit'), '<p class="post_edit">', '</p>' ); ?>
162
+
163
+ <?php if ($options['show_est']) { ?>
164
+
165
+ <p class="post_time">
166
+
167
+ <?php
168
+
169
+ $mycontent = $post->post_content;
170
+
171
+ $word = mb_strlen(strip_tags($mycontent));
172
+
173
+ $m = floor($word / 1000) + 1 ;
174
+
175
+ $est = $m;
176
+
177
+ printf(__("You can read this post in %d minutes.","lifefit"), $est);
178
+
179
+ ?>
180
+
181
+ </p>
182
+
183
+ <?php }; ?>
184
+
185
+ </div>
186
+
187
+
188
+
189
+ <div class="post">
190
+
191
+
192
+
193
+ <?php if(function_exists('bac_PostViews')) { bac_PostViews(get_the_ID()); } // count post view ?>
194
+
195
+
196
+
197
+ <?php if($options['single_code1']) { ?>
198
+
199
+ <div id="single_free_space1">
200
+
201
+ <?php echo $options['single_code1']; ?>
202
+
203
+ </div>
204
+
205
+ <?php };?>
206
+
207
+
208
+
209
+ <?php if ( has_post_thumbnail()) { if ($options['show_thumbnail']) : ?><div class="post_image"><?php the_post_thumbnail('large'); ?></div><?php endif; }; ?>
210
+
211
+
212
+
213
+ <?php the_content(); ?>
214
+
215
+ <?php wp_link_pages(); ?>
216
+
217
+
218
+
219
+ <?php if($options['single_code2']) { ?>
220
+
221
+ <div id="single_free_space2">
222
+
223
+ <?php echo $options['single_code2']; ?>
224
+
225
+ </div>
226
+
227
+ <?php };?>
228
+
229
+
230
+
231
+ </div><!-- END .post -->
232
+
233
+
234
+
235
+ <?php if ($options['show_date'] or $options['show_author'] or $options['show_comment'] or $options['show_category'] or $options['show_tag'] or $options['show_bookmark']) { ?>
236
+
237
+ <div id="post_meta_bottom" class="clearfix">
238
+
239
+ <?php if ($options['show_date'] or $options['show_author'] or $options['show_comment']) { ?>
240
+
241
+ <ul class="meta1 clearfix">
242
+
243
+ <?php if ($options['show_date']) : ?><li class="post_publish"><?php the_time(__('Y m.d', 'lifefit')) ?></li><?php endif; ?>
244
+
245
+ <?php if ($options['show_author']) : ?><li class="post_author"><?php the_author_posts_link(); ?></li><?php endif; ?>
246
+
247
+ <?php if ($options['show_comment']) : ?><li class="post_comment"><?php comments_popup_link(__('Write comment', 'lifefit'), __('1 comment', 'lifefit'), __('% comments', 'lifefit')); ?></li><?php endif; ?>
248
+
249
+ </ul>
250
+
251
+ <?php }; ?>
252
+
253
+ <?php if ($options['show_category'] or $options['show_tag']) { ?>
254
+
255
+ <ul class="meta2 clearfix">
256
+
257
+ <?php if ($options['show_category']) : ?><li class="post_category"><?php the_category(', '); ?></li><?php endif; ?>
258
+
259
+ <?php if ($options['show_tag']): ?><?php the_tags('<li class="post_tag">',', ','</li>'); ?><?php endif; ?>
260
+
261
+ </ul>
262
+
263
+ <?php }; ?>
264
+
265
+ <?php if ($options['show_bookmark']) { get_template_part('bookmark'); }; ?>
266
+
267
+ </div>
268
+
269
+ <?php }; ?>
270
+
271
+
272
+
273
+ <?php if($options['single_code3']) { ?>
274
+
275
+ <div id="single_free_space3">
276
+
277
+ <?php echo $options['single_code3']; ?>
278
+
279
+ </div>
280
+
281
+ <?php };?>
282
+
283
+
284
+
285
+ <?php endwhile; endif; ?>
286
+
287
+
288
+
289
+ <?php // related post
290
+
291
+ if ($options['show_related_post']) {
292
+
293
+ $odd_or_even = 'odd';
294
+
295
+ $categories = get_the_category($post->ID);
296
+
297
+ if ($categories) {
298
+
299
+ $category_ids = array();
300
+
301
+ foreach($categories as $individual_category) $category_ids[] = $individual_category->term_id;
302
+
303
+ $args=array(
304
+
305
+ 'category__in' => $category_ids,
306
+
307
+ 'post__not_in' => array($post->ID),
308
+
309
+ 'showposts'=>6,
310
+
311
+ 'orderby' => 'rand'
312
+
313
+ );
314
+
315
+ $my_query = new wp_query($args);
316
+
317
+ if($my_query->have_posts()) {
318
+
319
+ ?>
320
+
321
+ <div id="related_post">
322
+
323
+ <h3 class="headline2"><?php _e("Related post","lifefit"); ?></h3>
324
+
325
+ <ol class="clearfix">
326
+
327
+ <?php while ($my_query->have_posts()) { $my_query->the_post(); ?>
328
+
329
+ <li class="clearfix">
330
+
331
+ <?php if ($options['show_thumbnail']) { ?>
332
+
333
+ <a class="image" href="<?php the_permalink() ?>"><?php if ( has_post_thumbnail()) { the_post_thumbnail('size1'); } else { echo '<img src="'; bloginfo('template_url'); echo '/img/common/no_image3.gif" alt="" title="" />'; }; ?></a>
334
+
335
+ <?php }; ?>
336
+
337
+ <div class="meta">
338
+
339
+ <?php if ($options['show_date']) : ?><p class="date"><?php the_time(__('Y m.d', 'lifefit')) ?></p><?php endif; ?>
340
+
341
+ <h4 class="title"><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h4>
342
+
343
+ </div>
344
+
345
+ </li>
346
+
347
+ <?php }; ?>
348
+
349
+ </ol>
350
+
351
+ </div>
352
+
353
+ <?php }; }; wp_reset_query(); }; ?>
354
+
355
+
356
+
357
+ <?php if ($options['show_comment']) : if (function_exists('wp_list_comments')) { comments_template('', true); } else { comments_template(); }; endif; ?>
358
+
359
+
360
+
361
+ <div id="post_bottom" class="clearfix">
362
+
363
+ <?php if ($options['show_next_post']) { ?>
364
+
365
+ <div id="next_prev_link">
366
+
367
+ <?php lifefit_previous_post_link(27, '<p class="prev_post">%link</p>'); ?>
368
+
369
+ <?php lifefit_next_post_link(27, '<p class="next_post">%link</p>'); ?>
370
+
371
+ <a id="back_top" href="#nav_wrap"><?php _e('RETURN TOP', 'lifefit'); ?></a>
372
+
373
+ </div>
374
+
375
+ <?php } else { ?>
376
+
377
+ <a id="back_top" href="#nav_wrap"><?php _e('RETURN TOP', 'lifefit'); ?></a>
378
+
379
+ <?php }; ?>
380
+
381
+ </div>
382
+
383
+
384
+
385
+ </div><!-- END #main_content -->
386
+
387
+
388
+
389
+ <?php get_template_part('sidebar'); ?>
390
+
391
+ <?php if($options['layout'] == 'three_column1'||$options['layout'] == 'three_column2') { get_template_part('sidebar2'); }; ?>
392
+
393
+
394
+
395
+ <?php get_footer(); ?>
396
+
397
+ -------------------------------------------------