質問編集履歴
2
コードブロックをしました
title
CHANGED
File without changes
|
body
CHANGED
@@ -42,6 +42,7 @@
|
|
42
42
|
-------------------------------------------------
|
43
43
|
「single.php」に
|
44
44
|
|
45
|
+
```PHP
|
45
46
|
<?php
|
46
47
|
$post = $wp_query->post;
|
47
48
|
if ( in_category('特定のカテゴリーのスラッグ名') ) {
|
@@ -50,6 +51,7 @@
|
|
50
51
|
include(TEMPLATEPATH.'/single-nomal.php');
|
51
52
|
}
|
52
53
|
?>
|
54
|
+
```
|
53
55
|
|
54
56
|
と記述し、
|
55
57
|
「single-nomal.php」は最初のsingle.phpをコピーしたもののままで「特定のカテゴリー用.php」は任意の表示ができるようにしてあります。
|
@@ -60,6 +62,7 @@
|
|
60
62
|
|
61
63
|
元の「sigle.php」は下記のとおりです。
|
62
64
|
|
65
|
+
```php
|
63
66
|
<?php get_header(); $options = get_lifefit_option(); ?>
|
64
67
|
|
65
68
|
<div id="main_content">
|
@@ -196,4 +199,5 @@
|
|
196
199
|
<?php if($options['layout'] == 'three_column1'||$options['layout'] == 'three_column2') { get_template_part('sidebar2'); }; ?>
|
197
200
|
|
198
201
|
<?php get_footer(); ?>
|
202
|
+
```
|
199
203
|
-------------------------------------------------
|
1
表示周りについて更新しました
title
CHANGED
File without changes
|
body
CHANGED
@@ -36,4 +36,164 @@
|
|
36
36
|
(これをする前から、該当カテゴリーにすでに表示されていない状態なのは確認済みです)
|
37
37
|
|
38
38
|
何か怪しいファイルや、表示を妨げていると思われるファイル、プラグインを教えていただけるだけでも結構です。
|
39
|
-
手がかりをお願いします。
|
39
|
+
手がかりをお願いします。
|
40
|
+
-------------------------------------------------
|
41
|
+
追記
|
42
|
+
-------------------------------------------------
|
43
|
+
「single.php」に
|
44
|
+
|
45
|
+
<?php
|
46
|
+
$post = $wp_query->post;
|
47
|
+
if ( in_category('特定のカテゴリーのスラッグ名') ) {
|
48
|
+
include(TEMPLATEPATH.'/特定のカテゴリー用.php');
|
49
|
+
} else {
|
50
|
+
include(TEMPLATEPATH.'/single-nomal.php');
|
51
|
+
}
|
52
|
+
?>
|
53
|
+
|
54
|
+
と記述し、
|
55
|
+
「single-nomal.php」は最初のsingle.phpをコピーしたもののままで「特定のカテゴリー用.php」は任意の表示ができるようにしてあります。
|
56
|
+
CSSに関してはまだ触れていない状態です。
|
57
|
+
|
58
|
+
最初の「single.php」の段階でも、特定のカテゴリーで表示されることはありませんでした。
|
59
|
+
-------------------------------------------------
|
60
|
+
|
61
|
+
元の「sigle.php」は下記のとおりです。
|
62
|
+
|
63
|
+
<?php get_header(); $options = get_lifefit_option(); ?>
|
64
|
+
|
65
|
+
<div id="main_content">
|
66
|
+
|
67
|
+
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
|
68
|
+
|
69
|
+
<div id="post_header" class="clearfix">
|
70
|
+
<h2 class="title<?php if($options['layout'] == 'three_column1' || $options['layout'] == 'three_column2') { title_height3(); } else { title_height2(); }; ?>"><?php the_title(); ?></h2>
|
71
|
+
<?php if ($options['show_date']) : ?><p class="post_date"><?php the_time('m.d'); ?></p><?php endif; ?>
|
72
|
+
</div>
|
73
|
+
|
74
|
+
<div id="post_meta_top" class="clearfix">
|
75
|
+
<?php if ($options['show_author'] or $options['show_comment']) { ?>
|
76
|
+
<ul class="clearfix">
|
77
|
+
<?php if ($options['show_author']) : ?><li class="post_author"><?php the_author_posts_link(); ?></li><?php endif; ?>
|
78
|
+
<?php if ($options['show_comment']) : ?><li class="post_comment"><?php comments_popup_link(__('Write comment', 'lifefit'), __('1 comment', 'lifefit'), __('% comments', 'lifefit')); ?></li><?php endif; ?>
|
79
|
+
</ul>
|
80
|
+
<?php }; ?>
|
81
|
+
<?php edit_post_link(__('[ EDIT ]', 'lifefit'), '<p class="post_edit">', '</p>' ); ?>
|
82
|
+
<?php if ($options['show_est']) { ?>
|
83
|
+
<p class="post_time">
|
84
|
+
<?php
|
85
|
+
$mycontent = $post->post_content;
|
86
|
+
$word = mb_strlen(strip_tags($mycontent));
|
87
|
+
$m = floor($word / 1000) + 1 ;
|
88
|
+
$est = $m;
|
89
|
+
printf(__("You can read this post in %d minutes.","lifefit"), $est);
|
90
|
+
?>
|
91
|
+
</p>
|
92
|
+
<?php }; ?>
|
93
|
+
</div>
|
94
|
+
|
95
|
+
<div class="post">
|
96
|
+
|
97
|
+
<?php if(function_exists('bac_PostViews')) { bac_PostViews(get_the_ID()); } // count post view ?>
|
98
|
+
|
99
|
+
<?php if($options['single_code1']) { ?>
|
100
|
+
<div id="single_free_space1">
|
101
|
+
<?php echo $options['single_code1']; ?>
|
102
|
+
</div>
|
103
|
+
<?php };?>
|
104
|
+
|
105
|
+
<?php if ( has_post_thumbnail()) { if ($options['show_thumbnail']) : ?><div class="post_image"><?php the_post_thumbnail('large'); ?></div><?php endif; }; ?>
|
106
|
+
|
107
|
+
<?php the_content(); ?>
|
108
|
+
<?php wp_link_pages(); ?>
|
109
|
+
|
110
|
+
<?php if($options['single_code2']) { ?>
|
111
|
+
<div id="single_free_space2">
|
112
|
+
<?php echo $options['single_code2']; ?>
|
113
|
+
</div>
|
114
|
+
<?php };?>
|
115
|
+
|
116
|
+
</div><!-- END .post -->
|
117
|
+
|
118
|
+
<?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']) { ?>
|
119
|
+
<div id="post_meta_bottom" class="clearfix">
|
120
|
+
<?php if ($options['show_date'] or $options['show_author'] or $options['show_comment']) { ?>
|
121
|
+
<ul class="meta1 clearfix">
|
122
|
+
<?php if ($options['show_date']) : ?><li class="post_publish"><?php the_time(__('Y m.d', 'lifefit')) ?></li><?php endif; ?>
|
123
|
+
<?php if ($options['show_author']) : ?><li class="post_author"><?php the_author_posts_link(); ?></li><?php endif; ?>
|
124
|
+
<?php if ($options['show_comment']) : ?><li class="post_comment"><?php comments_popup_link(__('Write comment', 'lifefit'), __('1 comment', 'lifefit'), __('% comments', 'lifefit')); ?></li><?php endif; ?>
|
125
|
+
</ul>
|
126
|
+
<?php }; ?>
|
127
|
+
<?php if ($options['show_category'] or $options['show_tag']) { ?>
|
128
|
+
<ul class="meta2 clearfix">
|
129
|
+
<?php if ($options['show_category']) : ?><li class="post_category"><?php the_category(', '); ?></li><?php endif; ?>
|
130
|
+
<?php if ($options['show_tag']): ?><?php the_tags('<li class="post_tag">',', ','</li>'); ?><?php endif; ?>
|
131
|
+
</ul>
|
132
|
+
<?php }; ?>
|
133
|
+
<?php if ($options['show_bookmark']) { get_template_part('bookmark'); }; ?>
|
134
|
+
</div>
|
135
|
+
<?php }; ?>
|
136
|
+
|
137
|
+
<?php if($options['single_code3']) { ?>
|
138
|
+
<div id="single_free_space3">
|
139
|
+
<?php echo $options['single_code3']; ?>
|
140
|
+
</div>
|
141
|
+
<?php };?>
|
142
|
+
|
143
|
+
<?php endwhile; endif; ?>
|
144
|
+
|
145
|
+
<?php // related post
|
146
|
+
if ($options['show_related_post']) {
|
147
|
+
$odd_or_even = 'odd';
|
148
|
+
$categories = get_the_category($post->ID);
|
149
|
+
if ($categories) {
|
150
|
+
$category_ids = array();
|
151
|
+
foreach($categories as $individual_category) $category_ids[] = $individual_category->term_id;
|
152
|
+
$args=array(
|
153
|
+
'category__in' => $category_ids,
|
154
|
+
'post__not_in' => array($post->ID),
|
155
|
+
'showposts'=>6,
|
156
|
+
'orderby' => 'rand'
|
157
|
+
);
|
158
|
+
$my_query = new wp_query($args);
|
159
|
+
if($my_query->have_posts()) {
|
160
|
+
?>
|
161
|
+
<div id="related_post">
|
162
|
+
<h3 class="headline2"><?php _e("Related post","lifefit"); ?></h3>
|
163
|
+
<ol class="clearfix">
|
164
|
+
<?php while ($my_query->have_posts()) { $my_query->the_post(); ?>
|
165
|
+
<li class="clearfix">
|
166
|
+
<?php if ($options['show_thumbnail']) { ?>
|
167
|
+
<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>
|
168
|
+
<?php }; ?>
|
169
|
+
<div class="meta">
|
170
|
+
<?php if ($options['show_date']) : ?><p class="date"><?php the_time(__('Y m.d', 'lifefit')) ?></p><?php endif; ?>
|
171
|
+
<h4 class="title"><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h4>
|
172
|
+
</div>
|
173
|
+
</li>
|
174
|
+
<?php }; ?>
|
175
|
+
</ol>
|
176
|
+
</div>
|
177
|
+
<?php }; }; wp_reset_query(); }; ?>
|
178
|
+
|
179
|
+
<?php if ($options['show_comment']) : if (function_exists('wp_list_comments')) { comments_template('', true); } else { comments_template(); }; endif; ?>
|
180
|
+
|
181
|
+
<div id="post_bottom" class="clearfix">
|
182
|
+
<?php if ($options['show_next_post']) { ?>
|
183
|
+
<div id="next_prev_link">
|
184
|
+
<?php lifefit_previous_post_link(27, '<p class="prev_post">%link</p>'); ?>
|
185
|
+
<?php lifefit_next_post_link(27, '<p class="next_post">%link</p>'); ?>
|
186
|
+
<a id="back_top" href="#nav_wrap"><?php _e('RETURN TOP', 'lifefit'); ?></a>
|
187
|
+
</div>
|
188
|
+
<?php } else { ?>
|
189
|
+
<a id="back_top" href="#nav_wrap"><?php _e('RETURN TOP', 'lifefit'); ?></a>
|
190
|
+
<?php }; ?>
|
191
|
+
</div>
|
192
|
+
|
193
|
+
</div><!-- END #main_content -->
|
194
|
+
|
195
|
+
<?php get_template_part('sidebar'); ?>
|
196
|
+
<?php if($options['layout'] == 'three_column1'||$options['layout'] == 'three_column2') { get_template_part('sidebar2'); }; ?>
|
197
|
+
|
198
|
+
<?php get_footer(); ?>
|
199
|
+
-------------------------------------------------
|