切换到宽版
  • 494阅读
  • 1回复

[求助]评论降序改升序 [复制链接]

上一主题 下一主题
 
只看楼主 倒序阅读 使用道具 0楼 发表于: 2010-08-09
我想把我的博客的评论从降序(后发的在上)改为正常的升序(后发的在下)
可是怎么改也不成功
下面是我的评论代码,那位能帮我改下
不胜感激
  1.  <?php // Do not delete these lines
  2.         if ('comments.php' == basename($_SERVER['SCRIPT_FILENAME']))
  3.                 die ('Please do not load this page directly. Thanks!');
  4.         if (!empty($post->post_password)) { // if there's a password
  5.                 if ($_COOKIE['wp-postpass_' . COOKIEHASH] != $post->post_password) {  // and it doesn't match the cookie
  6.                         ?>
  7.                         <p class="nocomments">This post is password protected. Enter the password to view comments.</p>
  8.                         <?php
  9.                         return;
  10.                 }
  11.         }
  12.         /* This variable is for alternating comment background */
  13.         $oddcomment = 'class="alt" ';
  14. ?>
  15. <!-- You can start editing here. -->
  16. <?php if ($comments) : ?>
  17.         <?php $comments = array_reverse($comments) ?>
  18.         <h3 id="comments"><?php comments_number('暂无评论', '1个评论', '%个评论' );?></h3>
  19.         <ol class="commentlist">
  20.                 <?php wp_list_comments('callback=custom_comment');?>
  21.         </ol>
  22.     <?php
  23.                 // 如果用户在后台选择要显示评论分页
  24.                 if (get_option('page_comments')) {
  25.                         // 获取评论分页的 HTML
  26.                         $comment_pages = paginate_comments_links('echo=0');
  27.                         // 如果评论分页的 HTML 不为空, 显示导航式分页
  28.                         if ($comment_pages) {
  29.         ?>
  30.                 <div class="comment_navi">
  31.                         <span class="cpt">评论分页:</span> <?php echo $comment_pages; ?>
  32.                 </div>
  33.         <?php
  34.                         }
  35.                 }
  36.         ?>
  37. <?php else : // this is displayed if there are no comments so far ?>
  38.         <?php if ('open' == $post->comment_status) : ?>
  39.         <!-- If comments are open, but there are no comments. -->
  40.          <?php else : // comments are closed ?>
  41.                 <!-- If comments are closed. -->
  42.                 <p class="nocomments">Comments are closed.</p>
  43.         <?php endif; ?>
  44. <?php endif; ?>
  45. <div class="clear"></div>
  46. <?php if ('open' == $post->comment_status) : ?>
  47. <!-- Add Comment begin -->
  48. <div id="respond">
  49.         <h3 id="addcomment">发表评论</h3>
  50.     <div class="clear"></div>
  51.         <div id="cancel-comment-reply"><?php cancel_comment_reply_link('取消回复') ?></div>
  52. <?php if ( get_option('comment_registration') && !$user_ID ) : ?>
  53. <p>你必须 <a href="<?php echo get_option('siteurl'); ?>/wp-login.php?redirect_to=<?php echo urlencode(get_permalink()); ?>">登录后</a> 才能留言!</p>
  54. <?php else : ?>
  55. <form action="<?php echo get_option('siteurl'); ?>/wp-comments-post.php" method="post" id="commentform">
  56. <?php if ( $user_ID ) : ?>
  57. <p>您现在是以 <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="退出系统"> 点击退出系统 »</a></p>
  58.   
  59. <?php else : ?>
  60.     <div class="clear"></div>
  61.         <p><input type="text" name="author" id="author" value="<?php echo $comment_author; ?>" size="22" tabindex="1" /> 您的昵称 <em> * </em></p>
  62.         <p><input type="text" name="email" id="email" value="<?php echo $comment_author_email; ?>" size="22" tabindex="2" /> 您的邮箱 <em> * </em>(绝对保密)</p>
  63. <?php endif; ?>
  64.         <!--<p><small><strong>XHTML:</strong> You can use these tags: <code><?php echo allowed_tags(); ?></code></small></p>-->
  65.         <p class="smilies"><?php wp_smilies();?></p>
  66.         <p><textarea name="comment" id="comment" tabindex="4">添加评论内容</textarea></p>
  67.         <p><input name="submit" type="submit" id="submit" tabindex="5" value="提 交 (Ctrl+Enter)" /><?php comment_id_fields(); ?></p>
  68. <?php do_action('comment_form', $post->ID); ?>
  69. </form>
  70. <?php endif; // If registration required and not logged in ?>
  71. </div>
  72. <!-- Add Comment end -->
  73. <?php endif; // if you delete this the sky will fall on your head ?>


只看该作者 1楼 发表于: 2010-08-22
这个不需要改的,在后台有设置。
快速回复
限100 字节
 
上一个 下一个