クライアントの要望ですでにWordpressで構築されているサイトにComment Rating Field Pluginを導入し、一部のカテゴリで評価をコメントで入力できたり平均を表示させるようにしたいのですが、全く表示されません。
クライアントが使用しているテーマは「SINKA」というもので、ソースが入り組んでいて、どこで引っかかっているのか調べてもよくわかりません。
もしかしたら何かのプラグインと競合している可能性もあるので、クライアント側で有効化しているプラグインを書き出しておきます。
.html on PAGES
AddQuicktag
AdSense Manager
Advanced Custom Fields
Akismet
All In One SEO Pack
Broken Link Checker
Comment Rating Field Plugin(※これだけこちらで有効化しました)
Contact Form 7
EWWW Image Optimizer
Exec-PHP
Favicon by RealFaviconGenerator
Google XML Sitemaps
Ktai Style
PS Auto Sitemap
PuSHPress
Simple Tweet
TinyMCE Advanced
TypePad 絵文字 for TinyMCE
Wordbooker
WordPress Ping Optimizer
WordPress Popular Posts
WordPress インポートツール
WP Multibyte Patch
WP-PostViews
カスタムフィールドテンプレート
あとこちらでしたことはsingle.phpの簡単なカテゴリー毎に表示を変える分岐くらいです。
(これをする前から、該当カテゴリーにすでに表示されていない状態なのは確認済みです)
何か怪しいファイルや、表示を妨げていると思われるファイル、プラグインを教えていただけるだけでも結構です。
手がかりをお願いします。
追記
「single.php」に
PHP
1<?php 2$post = $wp_query->post; 3if ( in_category('特定のカテゴリーのスラッグ名') ) { 4include(TEMPLATEPATH.'/特定のカテゴリー用.php'); 5} else { 6include(TEMPLATEPATH.'/single-nomal.php'); 7} 8?>
と記述し、
「single-nomal.php」は最初のsingle.phpをコピーしたもののままで「特定のカテゴリー用.php」は任意の表示ができるようにしてあります。
CSSに関してはまだ触れていない状態です。
最初の「single.php」の段階でも、特定のカテゴリーで表示されることはありませんでした。
元の「sigle.php」は下記のとおりです。
php
1<?php get_header(); $options = get_lifefit_option(); ?> 2 3<div id="main_content"> 4 5 <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?> 6 7 <div id="post_header" class="clearfix"> 8 <h2 class="title<?php if($options['layout'] == 'three_column1' || $options['layout'] == 'three_column2') { title_height3(); } else { title_height2(); }; ?>"><?php the_title(); ?></h2> 9 <?php if ($options['show_date']) : ?><p class="post_date"><?php the_time('m.d'); ?></p><?php endif; ?> 10 </div> 11 12 <div id="post_meta_top" class="clearfix"> 13 <?php if ($options['show_author'] or $options['show_comment']) { ?> 14 <ul class="clearfix"> 15 <?php if ($options['show_author']) : ?><li class="post_author"><?php the_author_posts_link(); ?></li><?php endif; ?> 16 <?php if ($options['show_comment']) : ?><li class="post_comment"><?php comments_popup_link(__('Write comment', 'lifefit'), __('1 comment', 'lifefit'), __('% comments', 'lifefit')); ?></li><?php endif; ?> 17 </ul> 18 <?php }; ?> 19 <?php edit_post_link(__('[ EDIT ]', 'lifefit'), '<p class="post_edit">', '</p>' ); ?> 20 <?php if ($options['show_est']) { ?> 21 <p class="post_time"> 22 <?php 23 $mycontent = $post->post_content; 24 $word = mb_strlen(strip_tags($mycontent)); 25 $m = floor($word / 1000) + 1 ; 26 $est = $m; 27 printf(__("You can read this post in %d minutes.","lifefit"), $est); 28 ?> 29 </p> 30 <?php }; ?> 31 </div> 32 33 <div class="post"> 34 35 <?php if(function_exists('bac_PostViews')) { bac_PostViews(get_the_ID()); } // count post view ?> 36 37 <?php if($options['single_code1']) { ?> 38 <div id="single_free_space1"> 39 <?php echo $options['single_code1']; ?> 40 </div> 41 <?php };?> 42 43 <?php if ( has_post_thumbnail()) { if ($options['show_thumbnail']) : ?><div class="post_image"><?php the_post_thumbnail('large'); ?></div><?php endif; }; ?> 44 45 <?php the_content(); ?> 46 <?php wp_link_pages(); ?> 47 48 <?php if($options['single_code2']) { ?> 49 <div id="single_free_space2"> 50 <?php echo $options['single_code2']; ?> 51 </div> 52 <?php };?> 53 54 </div><!-- END .post --> 55 56 <?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']) { ?> 57 <div id="post_meta_bottom" class="clearfix"> 58 <?php if ($options['show_date'] or $options['show_author'] or $options['show_comment']) { ?> 59 <ul class="meta1 clearfix"> 60 <?php if ($options['show_date']) : ?><li class="post_publish"><?php the_time(__('Y m.d', 'lifefit')) ?></li><?php endif; ?> 61 <?php if ($options['show_author']) : ?><li class="post_author"><?php the_author_posts_link(); ?></li><?php endif; ?> 62 <?php if ($options['show_comment']) : ?><li class="post_comment"><?php comments_popup_link(__('Write comment', 'lifefit'), __('1 comment', 'lifefit'), __('% comments', 'lifefit')); ?></li><?php endif; ?> 63 </ul> 64 <?php }; ?> 65 <?php if ($options['show_category'] or $options['show_tag']) { ?> 66 <ul class="meta2 clearfix"> 67 <?php if ($options['show_category']) : ?><li class="post_category"><?php the_category(', '); ?></li><?php endif; ?> 68 <?php if ($options['show_tag']): ?><?php the_tags('<li class="post_tag">',', ','</li>'); ?><?php endif; ?> 69 </ul> 70 <?php }; ?> 71 <?php if ($options['show_bookmark']) { get_template_part('bookmark'); }; ?> 72 </div> 73 <?php }; ?> 74 75 <?php if($options['single_code3']) { ?> 76 <div id="single_free_space3"> 77 <?php echo $options['single_code3']; ?> 78 </div> 79 <?php };?> 80 81 <?php endwhile; endif; ?> 82 83 <?php // related post 84 if ($options['show_related_post']) { 85 $odd_or_even = 'odd'; 86 $categories = get_the_category($post->ID); 87 if ($categories) { 88 $category_ids = array(); 89 foreach($categories as $individual_category) $category_ids[] = $individual_category->term_id; 90 $args=array( 91 'category__in' => $category_ids, 92 'post__not_in' => array($post->ID), 93 'showposts'=>6, 94 'orderby' => 'rand' 95 ); 96 $my_query = new wp_query($args); 97 if($my_query->have_posts()) { 98 ?> 99 <div id="related_post"> 100 <h3 class="headline2"><?php _e("Related post","lifefit"); ?></h3> 101 <ol class="clearfix"> 102 <?php while ($my_query->have_posts()) { $my_query->the_post(); ?> 103 <li class="clearfix"> 104 <?php if ($options['show_thumbnail']) { ?> 105 <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> 106 <?php }; ?> 107 <div class="meta"> 108 <?php if ($options['show_date']) : ?><p class="date"><?php the_time(__('Y m.d', 'lifefit')) ?></p><?php endif; ?> 109 <h4 class="title"><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h4> 110 </div> 111 </li> 112 <?php }; ?> 113 </ol> 114 </div> 115 <?php }; }; wp_reset_query(); }; ?> 116 117 <?php if ($options['show_comment']) : if (function_exists('wp_list_comments')) { comments_template('', true); } else { comments_template(); }; endif; ?> 118 119 <div id="post_bottom" class="clearfix"> 120 <?php if ($options['show_next_post']) { ?> 121 <div id="next_prev_link"> 122 <?php lifefit_previous_post_link(27, '<p class="prev_post">%link</p>'); ?> 123 <?php lifefit_next_post_link(27, '<p class="next_post">%link</p>'); ?> 124 <a id="back_top" href="#nav_wrap"><?php _e('RETURN TOP', 'lifefit'); ?></a> 125 </div> 126 <?php } else { ?> 127 <a id="back_top" href="#nav_wrap"><?php _e('RETURN TOP', 'lifefit'); ?></a> 128 <?php }; ?> 129 </div> 130 131</div><!-- END #main_content --> 132 133<?php get_template_part('sidebar'); ?> 134<?php if($options['layout'] == 'three_column1'||$options['layout'] == 'three_column2') { get_template_part('sidebar2'); }; ?> 135 136<?php get_footer(); ?>
回答2件
あなたの回答
tips
プレビュー