ここには非常に単純な php ループがあり (以下を参照)、img クラス "yearofstudy" の後に 2 つの好きなカウンターと嫌いなカウンターを表示したいと考えています。ただし、テキストは画像の後に表示されません。実際の HTML の後に配置されていても。
コメントの Like と Dislike は、それらが表示される WP ループを作成するため、機能するために tis 関数内にある必要があります。基本的に、これを再配置して、好き嫌いがループに表示されるようにする必要がありますが、画像の後に表示されます。
私はこれを何時間も見つめていて、すべてのオンラインを見てきましたが、まだ何も見つかりません.
// Add the comment meta (saved earlier) to the comment text
// You can also output the comment meta values directly in comments template
add_filter( 'comment_text', 'modify_comment');
function modify_comment( $text ){
$plugin_url_path = WP_PLUGIN_URL;
if( $commenttitle = get_comment_meta( get_comment_ID(), 'title', true ) ) {
$commenttitle = '<strong>' . esc_attr( $commenttitle ) . '</strong><br/>';
$text = $commenttitle . $text;
}
if( $commentrating = get_comment_meta( get_comment_ID(), 'rating', true ) ) {
$commentrating = '<p class="comment-rating"> <img src="'. $plugin_url_path .
'/ExtendComment/images/'. $commentrating . 'star.gif" class="yearofstudy" /></p><br />';
$text = $text . $commentrating;
return $text;
// LIKE AND DISLIKE ON COMMENTS
if(function_exists('like_counter_c')) { like_counter_c('text for like'); }
if(function_exists('dislike_counter_c')) { dislike_counter_c('text for dislike'); }
}
}
編集:
RecoveringSince2003 によって提供される回答は機能し、好き嫌いを表示しますが、html 画像 yearofstudy の後に関数を表示することはできません。それは前に表示され、これは私が求めているものではありません。
ここにある例については、下にスクロールしてコメント/レビューを確認してください: http://universitycompare.com/universities/anglia-ruskin-university