WordPress“评论正在等待审核。”提交评论时未出现消息?

问题描述 投票:0回答:1

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 ?>

以及functions.php中的mytheme_comments函数

 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
        }
?>
php wordpress comments
1个回答
-1
投票

我的英语很差!

我已经找到解决方案了,你可以尝试一下!

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

例如。

<1>如果您的网站托管在“anotherdomainsite.com”上

并且您的域名是“yoursite.com”那么就会出现这个问题!

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

<2> 你可以尝试的事情 在您的网站上提交评论 当你完成后

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

例如。

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

放置 anotherdomainsite.com 而不是 yoursite.com

© www.soinside.com 2019 - 2024. All rights reserved.