home

wordpress为留言,评论,增加数字序列号

  讲一下如何在留言部分增加数字序列,以WordPress的Default模版为例:
修改comment.php

  1. 找到<ol class=”commentlist”>,在这句下面添加<?php $relax_comment_count=1; ?>
  2. 一般来说这句下面会有一段<li></li>的语句,在这段语句下面添加<?php $relax_comment_count++; ?>
  3. 上面说到的那句<li></li>中可以找到一句<?php comment_text() ?>,在此句上方添加<div class=”commentcount”><?php echo $relax_comment_count; ?></div>

最终像是这个样子:

  1. <ol class="commentlist">
  2.  
  3.     <?php $relax_comment_count=1; ?>
  4.  
  5.     <?php foreach ($comments as $comment) : ?>
  6.  
  7.         <li class ...
  8.         ...
  9.         ...
  10.         ...
  11.             <div class="commentcount"><?php echo $relax_comment_count; ?></div>
  12.  
  13.             <?php comment_text() ?>
  14.         </li>
  15.  
  16.         <?php $relax_comment_count++; ?>
  17.  
  18.     <?php endforeach; /* end for each comment */ ?>

接下来就是用css来调整一下commentcount的表现形式,在style.css里增加类似下面的内容:

  1. .commentcount {
  2. font-family: Georgia,sans-serif;
  3. font-size: 24px;
  4. font-weight: bold;
  5. color: #e0e0d0;
  6. float: right;
  7. }

文章到此完毕,其他模版基本也是一样的,大家自己推敲推敲。

Created By: sb123

Form Page: wordpress为留言,评论,增加数字序列号

Related Posts:

  • No Related Posts

11 Responses to “wordpress为留言,评论,增加数字序列号”

  1. 8bu
    January 17th, 2010 23:12
    11

    感觉速度快了好多啊···O(∩_∩)O哈哈~换IDC了》?

  2. 想知道
    January 17th, 2010 20:29
    10

    已阅,不错!

  3. iPod Touch Games
    May 27th, 2009 09:21
    9

    好片。

  4. BuY bEdDiNg
    May 19th, 2009 12:47
    8

    大,谢谢! ^ _ ^

  5. 泉州生活网
    March 18th, 2009 10:25
    7

    不错不错wordpress为留言,评论,增加数字序列号–sb123

  6. 开平
    January 15th, 2009 11:50
    6

    老大啊。上次我问你的文章是不是原创的你还没答我呢。。麻烦有空了把答案发我邮箱里

  7. 电视图纸
    January 10th, 2009 08:19
    5

    博主好啊。你的文章和博客都不错。我也是做网站的.有空我会常来转转

  8. 搜游人才网
    December 28th, 2008 14:24
    4

    wordpress为留言,评论,增加数字序列号–sb123诚交友情链接!^_^百度,GOOGLE收录就可以,最好是同类站wordpress为留言,评论,增加数字序列号–sb123QQ:451249 就可以和本站交换链接!

  9. 游戏人才网
    November 21st, 2008 00:24
    3

    wordpress为留言,评论,增加数字序列号–sb123诚交友情链接!^_^百度,GOOGLE收录就可以,最好是同类站wordpress为留言,评论,增加数字序列号–sb123QQ:373699996 就可以和本站交换链接!

  10. 搜游人才网
    November 6th, 2008 18:26
    2

    搜游人才网诚交友情链接
    www.ucrcw.com
    百度,GOOGLE收录就可以,最好是同类站
    QQ:373699996
    就可以和本站交换链接1163

  11. 月光博客的网摘 » Blog Archive » links for 2007-11-20
    November 21st, 2007 05:01
    1

    […] 为留言增加序列号 为留言增加序列号–讲一下如何在留言部分增加数字序列,以WordPress的Default模版为例:修改comment.php… (tags: wordpress plugin) […]

留言中至少要有一个中文字

Leave a Reply