WordPress的评论正在等待审核。提交评论时不显示消息?

时间:2009-11-13 16:54:15

标签: wordpress comments

WP样本的所有内容都非常标准,只需稍加修改即可。但是,当提交评论时,它不会显示“您的评论正在等待审核”消息。

comments.php:

    <div id="comment-block"> 
  <h4><?php comments_number('No Responses', 'One Response', '% Responses' );?> to &#8220;<?php the_title(); ?>&#8221;</h4>
  <ul id="commentlist">
   <?php wp_list_comments('type=comment&callback=mytheme_comment'); ?>
  </ul>
   <?php // 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. -->
    <?php else : // comments are closed ?>
    <!-- If comments are closed. -->
    <p class="nocomments">Comments are closed.</p>
   <?php endif; ?>

  <?php if ('open' == $post->comment_status) : ?>
  <h4>Leave a reply</h4>

  <div class="cancel-comment-reply">
   <small><?php cancel_comment_reply_link(); ?></small>
  </div>

  <?php if ( get_option('comment_registration') && !$user_ID ) : ?>
  <p>You must be <a href="<?php echo get_option('siteurl'); ?>/wp-login.php?redirect_to=<?php echo urlencode(get_permalink()); ?>">logged in</a> to post a comment.</p>
  <?php else : ?>

  <form action="<?php echo get_option('siteurl'); ?>/wp-comments-post.php" method="post" id="commentform">  
  <?php if ( $user_ID ) : ?>  
  <p class="loggedIn">Logged in as <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">Log out &raquo;</a></p>

  <?php else : ?>
  <table width="675" cellpadding="0" cellspacing="0" border="0">
   <tr><td style="padding-right: 20px;"><label for="author">Name <?php if ($req) echo "(required)"; ?></label></td>
    <td style="padding-right: 20px;"><label for="email">Email <?php if ($req) echo "(required)"; ?></label> <small>(will not be published)</small></td>
    <td><label for="url">Website <?php if ($req) echo "(required)"; ?></label></td>
   </tr>
   <tr><td style="padding-right: 20px;"><input type="text" name="author" id="author" value="<?php echo $comment_author; ?>" class="text" tabindex="1" <?php if ($req) echo "aria-required='true'"; ?> /></td>
    <td style="padding-right: 20px;"><input type="text" name="email" id="email" value="<?php echo $comment_author_email; ?>" class="text" tabindex="2" <?php if ($req) echo "aria-required='true'"; ?> /></td>
    <td><input type="text" name="url" id="url" value="<?php echo $comment_author_url; ?>" class="text" tabindex="3" /></td>
   </tr>
  </table>
  <?php endif; ?>
  <label for="comment">Comment <?php if ($req) echo "(required)"; ?></label><br />
  <textarea name="comment" id="comment" rows="10" tabindex="4" class="text"></textarea>
  <input name="submit" type="image" src="<?php bloginfo('template_directory'); ?>/images/submit_button.png" width="130" height="24" alt="Submit" id="submit" tabindex="5" />

  <?php comment_id_fields(); ?>
  <?php do_action('comment_form', $post->ID); ?>  
  </form>
 <div class="clear"></div>
 <?php endif; // If registration required and not logged in ?>
 </div>
<?php endif; // if you delete this the sky will fall on your head ?>

mytheme_comments在functions.php

中起作用
 function mytheme_comment($comment, $args, $depth) {
   $GLOBALS['comment'] = $comment; ?>
   <li <?php comment_class(); ?> id="li-comment-<?php comment_ID() ?>">
     <div id="comment-<?php comment_ID(); ?>">
      <span class="comment-author vcard">
         <?php printf(__('<cite class="fn">%s</cite> <span class="says">says at</span>'), get_comment_author_link()) ?>
      </span>

      <?php if ($comment->comment_approved == '0') : ?>
  <em><?php _e('Your comment is awaiting moderation.') ?></em>
  <br />
   <?php endif; ?>


      <span class="comment-meta commentmetadata"><a href="<?php echo htmlspecialchars( get_comment_link( $comment->comment_ID ) ) ?>">
   <?php printf(__('%2$s, %1$s'), get_comment_date(),  get_comment_time()) ?></a><?php edit_comment_link(__('(Edit)'),'  ','') ?></span>

      <?php comment_text() ?>

      <div class="reply">
         <?php comment_reply_link(array_merge( $args, array('depth' => $depth, 'max_depth' => $args['max_depth']))) ?>
      </div>
     </div>
<?php
        }
?>

1 个答案:

答案 0 :(得分:0)

我的英语很差!

如果你能试试,我有解决方案!

此问题通常与托管网站的实际域名相关

例如

&lt; 1&gt;如果您的网站托管在“anotherdomainsite.com”

并且您的域名是“yoursite.com”然后会出现此问题!

您可以尝试更改您的实际域名!这实际上托管了你的网站! 意味着托管和域应该是一样的!

&LT 2 - ;你可以尝试的事情 在您的网站上提交评论 当你完成时

替换实际的托管域而不是指向域

例如。

http://yoursite.com/yourposturl/#comment-265

放置 anotherdomainsite.com 而不是yoursite.com