質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.50%
WordPress

WordPressは、PHPで開発されているオープンソースのブログソフトウェアです。データベース管理システムにはMySQLを用いています。フリーのブログソフトウェアの中では最も人気が高く、PHPとHTMLを使って簡単にテンプレートをカスタマイズすることができます。

PHP

PHPは、Webサイト構築に特化して開発されたプログラミング言語です。大きな特徴のひとつは、HTMLに直接プログラムを埋め込むことができるという点です。PHPを用いることで、HTMLを動的コンテンツとして出力できます。HTMLがそのままブラウザに表示されるのに対し、PHPプログラムはサーバ側で実行された結果がブラウザに表示されるため、PHPスクリプトは「サーバサイドスクリプト」と呼ばれています。

プラグイン

プラグイン(plug-in)は、ソフトウェアアプリケーションの機能拡張の為に開発された、一組のソフトウェアコンポーネントのことを指します。

Q&A

解決済

2回答

4359閲覧

Wordpress:Comment Rating Field Pluginが表示されません

yukko

総合スコア21

WordPress

WordPressは、PHPで開発されているオープンソースのブログソフトウェアです。データベース管理システムにはMySQLを用いています。フリーのブログソフトウェアの中では最も人気が高く、PHPとHTMLを使って簡単にテンプレートをカスタマイズすることができます。

PHP

PHPは、Webサイト構築に特化して開発されたプログラミング言語です。大きな特徴のひとつは、HTMLに直接プログラムを埋め込むことができるという点です。PHPを用いることで、HTMLを動的コンテンツとして出力できます。HTMLがそのままブラウザに表示されるのに対し、PHPプログラムはサーバ側で実行された結果がブラウザに表示されるため、PHPスクリプトは「サーバサイドスクリプト」と呼ばれています。

プラグイン

プラグイン(plug-in)は、ソフトウェアアプリケーションの機能拡張の為に開発された、一組のソフトウェアコンポーネントのことを指します。

0グッド

0クリップ

投稿2016/04/23 05:45

編集2016/04/23 06:54

クライアントの要望ですでに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(); ?>

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

kei344

2016/04/23 05:57

「表示を変える分岐」など、表示周りの具体的な記述をお書きください。
yukko

2016/04/23 06:11

「single.php」に <?php $post = $wp_query->post; if ( in_category('特定のカテゴリーのスラッグ名') ) { include(TEMPLATEPATH.'/特定のカテゴリー用.php'); } else { include(TEMPLATEPATH.'/single-nomal.php'); } ?> と記述し、 「single-nomal.php」は最初のsingle.phpをコピーしたもののままで「特定のカテゴリー用.php」は任意の表示ができるようにしてあります。 CSSに関してはまだ触れていない状態です。 最初の「single.php」の段階でも、特定のカテゴリーで表示されることはありませんでした。
yukko

2016/04/23 06:13

「SINKA」の「single.php」は下記になります。 <?php get_header(); $options = get_lifefit_option(); ?> <div id="main_content"> <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?> <div id="post_header" class="clearfix"> <h2 class="title<?php if($options['layout'] == 'three_column1' || $options['layout'] == 'three_column2') { title_height3(); } else { title_height2(); }; ?>"><?php the_title(); ?></h2> <?php if ($options['show_date']) : ?><p class="post_date"><?php the_time('m.d'); ?></p><?php endif; ?> </div> <div id="post_meta_top" class="clearfix"> <?php if ($options['show_author'] or $options['show_comment']) { ?> <ul class="clearfix"> <?php if ($options['show_author']) : ?><li class="post_author"><?php the_author_posts_link(); ?></li><?php endif; ?> <?php if ($options['show_comment']) : ?><li class="post_comment"><?php comments_popup_link(__('Write comment', 'lifefit'), __('1 comment', 'lifefit'), __('% comments', 'lifefit')); ?></li><?php endif; ?> </ul> <?php }; ?> <?php edit_post_link(__('[ EDIT ]', 'lifefit'), '<p class="post_edit">', '</p>' ); ?> <?php if ($options['show_est']) { ?> <p class="post_time"> <?php $mycontent = $post->post_content; $word = mb_strlen(strip_tags($mycontent)); $m = floor($word / 1000) + 1 ; $est = $m; printf(__("You can read this post in %d minutes.","lifefit"), $est); ?> </p> <?php }; ?> </div> <div class="post"> <?php if(function_exists('bac_PostViews')) { bac_PostViews(get_the_ID()); } // count post view ?> <?php if($options['single_code1']) { ?> <div id="single_free_space1"> <?php echo $options['single_code1']; ?> </div> <?php };?> <?php if ( has_post_thumbnail()) { if ($options['show_thumbnail']) : ?><div class="post_image"><?php the_post_thumbnail('large'); ?></div><?php endif; }; ?> <?php the_content(); ?> <?php wp_link_pages(); ?> <?php if($options['single_code2']) { ?> <div id="single_free_space2"> <?php echo $options['single_code2']; ?> </div> <?php };?> </div><!-- END .post --> <?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']) { ?> <div id="post_meta_bottom" class="clearfix"> <?php if ($options['show_date'] or $options['show_author'] or $options['show_comment']) { ?> <ul class="meta1 clearfix"> <?php if ($options['show_date']) : ?><li class="post_publish"><?php the_time(__('Y m.d', 'lifefit')) ?></li><?php endif; ?> <?php if ($options['show_author']) : ?><li class="post_author"><?php the_author_posts_link(); ?></li><?php endif; ?> <?php if ($options['show_comment']) : ?><li class="post_comment"><?php comments_popup_link(__('Write comment', 'lifefit'), __('1 comment', 'lifefit'), __('% comments', 'lifefit')); ?></li><?php endif; ?> </ul> <?php }; ?> <?php if ($options['show_category'] or $options['show_tag']) { ?> <ul class="meta2 clearfix"> <?php if ($options['show_category']) : ?><li class="post_category"><?php the_category(', '); ?></li><?php endif; ?> <?php if ($options['show_tag']): ?><?php the_tags('<li class="post_tag">',', ','</li>'); ?><?php endif; ?> </ul> <?php }; ?> <?php if ($options['show_bookmark']) { get_template_part('bookmark'); }; ?> </div> <?php }; ?> <?php if($options['single_code3']) { ?> <div id="single_free_space3"> <?php echo $options['single_code3']; ?> </div> <?php };?> <?php endwhile; endif; ?> <?php // related post if ($options['show_related_post']) { $odd_or_even = 'odd'; $categories = get_the_category($post->ID); if ($categories) { $category_ids = array(); foreach($categories as $individual_category) $category_ids[] = $individual_category->term_id; $args=array( 'category__in' => $category_ids, 'post__not_in' => array($post->ID), 'showposts'=>6, 'orderby' => 'rand' ); $my_query = new wp_query($args); if($my_query->have_posts()) { ?> <div id="related_post"> <h3 class="headline2"><?php _e("Related post","lifefit"); ?></h3> <ol class="clearfix"> <?php while ($my_query->have_posts()) { $my_query->the_post(); ?> <li class="clearfix"> <?php if ($options['show_thumbnail']) { ?> <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> <?php }; ?> <div class="meta"> <?php if ($options['show_date']) : ?><p class="date"><?php the_time(__('Y m.d', 'lifefit')) ?></p><?php endif; ?> <h4 class="title"><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h4> </div> </li> <?php }; ?> </ol> </div> <?php }; }; wp_reset_query(); }; ?> <?php if ($options['show_comment']) : if (function_exists('wp_list_comments')) { comments_template('', true); } else { comments_template(); }; endif; ?> <div id="post_bottom" class="clearfix"> <?php if ($options['show_next_post']) { ?> <div id="next_prev_link"> <?php lifefit_previous_post_link(27, '<p class="prev_post">%link</p>'); ?> <?php lifefit_next_post_link(27, '<p class="next_post">%link</p>'); ?> <a id="back_top" href="#nav_wrap"><?php _e('RETURN TOP', 'lifefit'); ?></a> </div> <?php } else { ?> <a id="back_top" href="#nav_wrap"><?php _e('RETURN TOP', 'lifefit'); ?></a> <?php }; ?> </div> </div><!-- END #main_content --> <?php get_template_part('sidebar'); ?> <?php if($options['layout'] == 'three_column1'||$options['layout'] == 'three_column2') { get_template_part('sidebar2'); }; ?> <?php get_footer(); ?>
yukko

2016/04/23 06:17

申し訳ありません。見づらかったので追記のほうをご参照ください。
kei344

2016/04/23 06:37

コードはコードブロックで囲んでください。```(バッククオート3つ)で囲み、前後に改行をいれるか、コードを選択して「</>」ボタンを押すとコードブロックになります。
yukko

2016/04/23 06:52

無知ですみません。コードというのは['layout']という['***']ものですよね?「SINKA」はクライアントが購入したテーマなので、こちらのほうは原則いじらないことになっております。ですが今後の勉強になります。ありがとうございます。
yukko

2016/04/23 06:55

terateilの使用方法の話でした。すみません。見づらかったと思います;
kei344

2016/04/23 06:59

いえ、修正ありがとうございます。
guest

回答2

0

ベストアンサー

下記サイトで「SINKA」の「comments.php」の一部を拝見しました。

【WordPressのコメント欄(メールアドレスとウェブサイト必須)を編集して書き込み投稿を増やす方法 | ビジネスアーティスト永田武(たけやん)公式サイト】
http://take-yan.com/wordpress-4-4899#SINKA

結論から言うと、comment_form() という関数を使用しない記載のため、その中で呼ばれるフック(プラグインが使用するもの)が呼ばれないため、描画されていないものだと推測されます。
下記サイトは公式リファレンスのcomment_form() に関連する関数・フックを検索した結果です。「Action Hook」というものがたくさん動いていることがふんわり解ると思います。

【Search Results for “comment_form” | WordPress Developer Resources】
https://developer.wordpress.org/?s=comment_form


comment_form() を使いつつカスタマイズする方法は下記など参照してみてください。「WordPress comment_form カスタマイズ」で検索するのもいいと思います。

【Wordpressのコメントフォーム(comment_form)をカスタマイズ - トリコロールな猫】
http://www.nekotricolor.com/entry/2013/01/10/745/

【コメント欄を表示するcomments.phpを作る [WordPressテーマ作成の手順16] | *Web Design 覚え書き*】
http://webdesign.practice.jp/wordpress-theme16-comments-php

投稿2016/04/23 07:18

kei344

総合スコア69364

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

yukko

2016/04/23 07:20

ありがとうございます!一番知りたかったことです!助かりました!
guest

0

「comments.php」あたりが怪しいと思い直し、「SINKA」特有の「comments.php」を「wordpress」の「twentyfourteen」の「comments.php」に上書きしたら表示されるようになりました。
一旦元に戻したので、こちらのほうから検証していきたいと思います。
(「twentyfourteen」の「comments.php」を「SINKA」に近づけていく方向で行きます。)

質問して客観的にみれたので、助かりました。ありがとうございました。

投稿2016/04/23 06:45

yukko

総合スコア21

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.50%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問