我下载了"喜欢/不喜欢的计数器" wordpress上的插件,并希望在所有评论中包含喜欢/不喜欢的按钮。
喜欢和不喜欢按钮的代码是:
<?php if(function_exists('like_counter_c')) { like_counter_c("Like"); } ?>
<?php if(function_exists('dislike_counter_c')) {dislike_counter_c("Dislike"); } ?>
我已尝试将其放在comments.php的不同部分,但要么将其放在评论的上方或下方,而不是根据需要放在所有部分上。
有谁知道我应该把它放在哪里?
以下是我的comments.php中的代码:
<?php
// Do not delete these lines
if (!empty($_SERVER['SCRIPT_FILENAME']) && 'comments.php' == basename($_SERVER['SCRIPT_FILENAME']))
die ('Please do not load this page directly. Thanks!');
if ( post_password_required() ) { ?>
<p class="nocomments">This post is password protected. Enter the password to view comments.</p>
<?php
return;
}
?>
<!-- You can start editing here. -->
<?php if (have_comments()) { ?>
<div id="commentspost"><a name="commentspost"></a>
<h2 class="title"><?php comment_type_count();?> <?php _e('Comments', 'wpzoom'); ?></h2>
<ol class="normalComments"><?php wp_list_comments('type=all&avatar_size=60');?></ol>
</div><!-- end #commentspost -->
<?php if ('closed' == $post->comment_status) : ?>
<?php endif; ?>
<?php }
else { // this is displayed if there are no comments so far ?>
<?php if ('open' == $post->comment_status) { ?>
<!-- If comments are open, but there are no comments. -->
<div id="commentspost">
<h2 class="title">0 <?php _e('Comments', 'wpzoom'); ?></h2>
<p><?php _e('You can be the first one to leave a comment', 'wpzoom'); ?>.</p>
</div>
<?php } else { // comments are closed ?>
<!-- If comments are closed. -->
<?php } ?>
<?php } ?>
<?php if ('open' == $post->comment_status) : ?>
<div id="respond">
<div class="cleaner"> </div>
<div class="cancel-comment-reply"><p><?php cancel_comment_reply_link(); ?></p></div>
<?php if ( get_option('comment_registration') && !$user_ID ) : ?>
<p><?php _e('You must be', 'wpzoom'); ?> <a href="<?php echo get_option('siteurl'); ?>/wp-login.php?redirect_to=<?php echo urlencode(get_permalink()); ?>"><?php _e('logged in', 'wpzoom'); ?></a> <?php _e('to post a comment.', 'wpzoom'); ?></p>
<?php else : ?>
<?php comment_form(); ?>
<?php if ( $user_ID ) : ?>
<p><?php _e('Logged in as', 'wpzoom'); ?> <a href="<?php echo get_option('siteurl'); ?>/wp-admin/profile.php"><?php echo $user_identity; ?></a>. <a href="<?php echo wp_logout_url(get_permalink()); ?>" title="Log out of this account"><?php _e('Log out', 'wpzoom'); ?> »</a></p>
<?php endif; ?>
<div class="cleaner"> </div>
<?php comment_id_fields(); ?>
<?php do_action('comment_form', $post->ID); ?>
</form>
<?php endif; // If registration required and not logged in ?>
</div>
<?php endif; // if you delete this the sky will fall on your head ?>
除非我当然错了,它应该包含在loop.php中?
提前致谢!