WordPress主题(Theme): G7v6 final发布

Posted in WordPress / 软硬一本 @ Jul 30th, 2008 by underone |

WordPress theme G7v6 final

这个……就算final了吧(再有问题再随改吧),比起beta又修改了一些东西,包括:

压缩css文件(但是没整理)
css文件中增加了wp-pagenavi插件的效果
增加了footer效果
调整了导航栏的效果
导航栏背景为了应景,增加了云纹效果……当然相应的文件也大了19K……

支持WordPress的内置Gravatar
支持widgets(但不推荐使用)
推荐安装使用以下插件(均为可装可不装,不装并不影响你的任何使用):
WP中文工具箱WordPress Related PostsWP-PageNavSimple Tags
特别推荐内置的17fav Bookmark & Share插件(使用该插件请前往后台将"手动插入按钮"选上)
目前测试浏览器仅限于IE6和FF3
注:本Theme基于Creative Commons协议2.5发布

下载:G7_v6_final.zip

顺便说一句,由于身体的原因,下一个版本的theme可能不会很快发布了。但是我可以告诉大家那是G7v4

BTW:有海那边的友人给制作了G7v6的三栏版本,有三栏需求的朋友可以去看看。我这里观察下载地址貌似需要翻墙……

延展阅读

229 Responses to “WordPress主题(Theme): G7v6 final发布”

  1. Denis  Reply to this comment

    沙发下!

  2. 蓝色海洋  Reply to this comment

    谢谢了,已更新!等待新作品

  3. Dismory  Reply to this comment

    占座

  4. neekey  Reply to this comment

    占座~~~支持

  5. L.E.I  Reply to this comment

    额,下载拿去修理。。

  6. motta  Reply to this comment

    final了~~~~ 赞!

  7. underone  Reply to this comment

    @L.E.I
    出了毛病记得回来报告。。

  8. 虫儿飞  Reply to this comment

    抽个时间准备移植吧……

  9. underone  Reply to this comment

    @虫儿飞
    顶你

  10. Charles  Reply to this comment

    差点就以为这个主题没有页面导航,总体很好看,但是页面导航小了

  11. underone  Reply to this comment

    恩。。。导航我想做成图片效果背景来着。。懒了。。

  12. Dismory  Reply to this comment

    WP帐户怎么自定义头像?

  13. Dismory  Reply to this comment

    sidebar里标签云下那堆小图标是怎么弄的..?

  14. underone  Reply to this comment

    @Dismory
    那是个插件,叫wp_addbookmarks,搜一下吧
    至于头像,去http://www.gravatar.com/注册即可啊

  15. frozens  Reply to this comment

    经常解剖大大的皮肤,呵呵

  16. underone  Reply to this comment

    :)

  17. Sparanoid  Reply to this comment

    测栏的 sidebar 在 opera9.5 下 hover 效果有问题(貌似)

  18. Dismory  Reply to this comment

    @underone
    再次感谢

  19. Black-Xstar  Reply to this comment

    underone的主题一直是我最喜欢的!

  20. willerce  Reply to this comment

    增加了footer效果.
    请问footer在哪?

  21. 二手科学家  Reply to this comment

    老默,身体要紧。保重

  22. Flyx  Reply to this comment

    期待已久,以前解剖你的主题里学了很多,致谢^_^

  23. Dianso  Reply to this comment

    终于出来了啊

  24. Alan  Reply to this comment

    路过支持,顺便转鸟 :D

  25. Wordpress 主题: G7v6 Final | Alan's World  Reply to this comment

    [...] 的 G7v6 主题也弄了挺久了, 终于是 Final [...]

  26. L.E.I  Reply to this comment

    有个问题来提一下,页面的话,如果不允许评论,SIDEBAR会错位。

  27. Dismory  Reply to this comment

    同上,关闭评论的sidebar会错位

  28. hansey  Reply to this comment

    速度很快,很喜欢,谢谢

  29. dintin.cn  Reply to this comment

    发现评论页显示有BUG,,已经截图发gmail给你了,,
    期待解答。。。。^_^

    IE 没问题 Firefox3 有很明显问题!

  30. sam  Reply to this comment

    已很好了.. 但有点导航在哪??

    http://www.zlop.cn

  31. dintin.cn  Reply to this comment

    非常稀饭你的主题,,但是你自己blog的评论界面与G7v6的貌似一样,,为什么Firefox与IE都没问题,,而G7v6在firefox中显示会出问题?

    我的IE 7,Firefox 3,,WordPress 2.6

    期待中。。。

  32. underone  Reply to this comment

    @Sparanoid
    我在9.51下看了眼,没有问题啊,是啥样的问题能不能截图看看?谢谢啊
    @sam
    啥意思?
    @Dintin
    你的mail我看了,你说的第一个用户评论错位的问题,我这里本地看还是没发现问题……我再想想为什么
    你说第二个IE和FF都错位的问题,是因为内容没有用p和/p框起来

  33. underone  Reply to this comment

    @all
    俺娘啊,关闭评论错位一事我记得上次beta解决过了,可能改final的时候版本搞错了……
    重新上载了一份,大家看看还有问题没,汗,我太不谨慎了

    @willerce
    屏幕最下边不是么

  34. dintin.cn  Reply to this comment

    第一个用户评论错位的问题,,IE没有,,只有FF3有这个问题,,我也觉得怪怪。。。

  35. underone  Reply to this comment

    你收信看看
    你这个问题我遇到过

  36. Dismory  Reply to this comment

    underone大能告诉下错位的问题具体修改哪吗
    不想重新上载了……

  37. dintin.cn  Reply to this comment

    第二个IE和FF都错位的问题,不是 的问题
    我找到原因了,,写得字数太少,,栏被压缩,,导致底部错位,,写多点就没问题了,,^_^,,不改也没大碍,,
    就是 第一个用户评论错位的问题 在FF3中需要改进一下,,我改了,貌似不起作用,,就是都改成

    这个在FF3也没用

    谢谢丸子哦

  38. Dismory  Reply to this comment

    呃,还是重新上载了

  39. underone  Reply to this comment

    @dintin
    你把所有插件都关掉试试
    @Dismory
    comments.php中118还是117行附近
    有个/DIV,删掉

  40. dintin.cn  Reply to this comment

    好了好了,,原来主机受到攻击,,,,传上去,,没同步

  41. Dismory  Reply to this comment

    underone大,sidebar里recent comments那块如何修改能改成本站的样子?

  42. underone  Reply to this comment

    那是个插件:
    看这里http://www.fighton.cn/

  43. underone  Reply to this comment

    测试


  44. 97cool  Reply to this comment

    其实细节都处理得蛮到位,但整体有点怪怪的。

  45. underone  Reply to this comment

    嘿嘿

  46. Dismory  Reply to this comment

    已经添加那个plugin了
    FF3下,第一个人的评论版式有问题,显示不正常

  47. Dismory  Reply to this comment

    header的logo字体要如何替换呢?

  48. underone  Reply to this comment

    搜css里的H1部分

  49. underone  Reply to this comment

    @Dismory
    不是第一个人说了。。但是我这里FF3就是死活没法重现这个问题
    原来的beta版也是这样?

  50. dintin.cn  Reply to this comment

    Dismory,,,,我原来FF3一直是第一个人的评论版式有问题,显示不正常,,,

    underone 的源码中加BR是对的,

    ,,现在问题没了,

    ,不相信FF3查看我的测试页 Dintin.cn

  51. dintin.cn  Reply to this comment

    丸子好,你的sidebar上的 best in Jul 是什么插件?
    还有你的 收藏&分享 按钮是绿色的,我是蓝色的,怎么弄绿色的?上了17fav,什么也查不到。

    期待解答 :-) Wish you a happy day !

  52. underone  Reply to this comment

    绿色的图是我自己做的。
    当月最佳文章是插件效果实现的
    这个插件Popularity Contest
    http://alexking.org/projects/wordpress

  53. underone  Reply to this comment

    测试

  54. Dismory  Reply to this comment

    我想知道single.php里日志下方的多tabs是怎么实现的……

  55. Dianso  Reply to this comment

    来报告一个小小的缺陷
    footer.php中title中有g7v5字样
    完全不影响使用的
    另外请问你的logo如何制作的
    可以帮我做个么?
    做个Dianso或者Dianso's Blog谢谢了
    最好发到我邮箱里吧

  56. Dismory  Reply to this comment

    在搞,tab pane

  57. underone  Reply to this comment

    @Dianso
    果然,copy代码的时候没检查
    logo不是不能给你做,问题那个字体是中文字体,英文不是那个效果:(

  58. chunfa  Reply to this comment

    早就期待你的final版本了,终于出来了。

  59. Jason One  Reply to this comment

    大哥,既然看起来你的主题没问题,但我用你的主题也有问题.侧右栏中的评论有问题,头像乱放在右边,应该放在文字的左边才对!看看我的网站,http://www.jasonone.com 我喜欢你的主题,希望你尽管解决

  60. Dismory  Reply to this comment

    underone大,我装了那个recent comments插件,在ff3下跑很正常,在ie7下会溢出,我看您这很正常啊,不知是哪的问题...

  61. Dismory  Reply to this comment

    在ie7下,左侧应该显示在左侧,可以会跑到右边,把左边空出来,然后id和评论就跑到了下一行,这是什么问题?

  62. underone  Reply to this comment

    @Jason One
    我在你blog上没发现sidebar里有什么头像……

  63. Dismory  Reply to this comment

    我把错版问题截图发您邮箱里了,去看下吧

  64. Jason One  Reply to this comment

    我刚试了关闭显示头像,结果弄不好.现在有头像,请您看看吧

  65. underone  Reply to this comment

    哦,我估计你们俩都是一个问题
    那个插件有自己单独的.css文件,我把那个文件重写过以适应这个主题

    1. .rc_item .rc_avatar {
    2.         line-height:1px;
    3. }
    4. .rc_item .rc_avatar img {
    5.         background:#FFF;
    6.         padding:2px;
    7.         border:1px solid #e1e1e1;
    8. }
    9. .rc_item .rc_left {
    10.         display:inline;
    11.         float:left;
    12.         padding-right:7px !important;
    13.         padding-right:4px;
    14.         clear: left;
    15. }
    16. li.rc_item {
    17.         margin-bottom: 8px;
    18. }
    19. .rc_item .rc_right {
    20.         display:inline;
    21.         float:right;
    22.         padding-left:7px !important;
    23.         padding-left:4px;
    24. }
    25. .rc_item .rc_info .author_name {
    26.         font-weight:bold;
    27. }
    28. .rc_avatar .avatar {
    29.         float: left;
    30.         margin-bottom: 8px;
    31. }
    32. #rc_newest {
    33.         float:left;
    34.         padding-right:10px;
    35. }
    36. #rc_newer {
    37.         float:left;
    38. }
    39. #rc_older {
    40.         float:right;
    41. }
    42. .rc_fixed {
    43.         clear:both;
    44. }
    45.       
    46. .rc_content {
    47.         color: #7d7d7d;
    48.         margin-bottom: 8px;
    49. }
  66. Jason One  Reply to this comment

    我明白了.也许不支持IE,我刚用FF,看起来没问题.可能是代码问题,请你马上解决 还有希望你优先用IE修改问题

  67. underone  Reply to this comment

    楼上这位兄弟,我想你应该知道
    做一个WordPress主题,我想谁也不可能知道每个用户会去用什么样的插件,而那个插件又会怎么去写css的
    所以完全我可以说那是插件的问题,跟我的主题没关系,但是上边我还是给出了解决办法
    你说什么
    “请你马上解决”
    “希望你优先用IE修改问题”
    对此我确实觉得:那不是我的问题
    如果以后你用别的主题也发生类似的事情,希望你能去问问插件的作者如何解决。

  68. Jason One  Reply to this comment

    居然解决了,还是谢谢你

  69. Jason One  Reply to this comment

    我说的那句话不对了,而我毕竟是菜鸟.我对你误会了,很抱歉

  70. underone  Reply to this comment

    不客气。我没说你说的对还是不对
    我只是说,这样的事情,应该首先去问插件的作者
    只是恰巧我也用这个插件,所以有所谓的解决办法,如果我没用过,很可能我也不知道怎么解决

  71. underone  Reply to this comment

    @Dismory
    你的解决了么,我没IE7

  72. jivinlee  Reply to this comment

    支持呀!太牛啦!

  73. mg12  Reply to this comment

    好多人...
    您老人家一发布主题真地就很热.
    那个云纹效果很好, 我自己网上找一下, 找不到明天再来索要.

  74. 《进步志》 » 咋办?  Reply to this comment

    [...] 我好象特别喜欢更换Blog主题,今天看到老默发布了G7v6 final,立马就换上了,感觉还是很不错的,只是不知道为什么最下面冒出了个滚动条来……另外还有两个问题个人觉得可以改进: [...]

  75. 锐风  Reply to this comment

    无语.. menu 还是没换位置..

    @mg12 那个云纹我 blog 里有的 --> http://iruif.cn/blog/

  76. underone  Reply to this comment

    换哪里啊,都放不下。。。。。。。。

  77. 锐风  Reply to this comment

    身体原因??

  78. Dismory  Reply to this comment

    哈,按照您贴的css代码覆盖了下问题已经解决,谢过underone大

  79. underone  Reply to this comment

    @锐风
    是,身体不太好最近

  80. Dismory  Reply to this comment

    tabpane是不是在您的主题下是不是css也需要重写...

  81. underone  Reply to this comment

    tabpane是什么。。

  82. Dismory  Reply to this comment

    呃……
    好吧,看来我想当然了,我还是请教那个single.php里日志下方那几个tabs是怎么实现的?

  83. underone  Reply to this comment

    那是我随便上百度找的“tab”“脚本”
    有各种各样的。。。。我稍微美化了一下而已。。

  84. Dismory  Reply to this comment

    underone大,我又有问题请教,怎么让wp-related-post插件里定义的标题,比如:相关文章,显示在的调用处

  85. underone  Reply to this comment

    你是说tab效果还是普通调用?
    tab效果里我是手写标题上去的而已。

  86. Dismory  Reply to this comment

    刚才说错了,是让定义的标题 不 显示在《?php wp23_related_posts(); ?》调用处

  87. Dismory  Reply to this comment

    嗯,是啊,我也是手写上标题,可是一调用php,就自己挂上了设置里的标题...

  88. underone  Reply to this comment

    是啊,你要去插件后台把标题那部分留空啊。。。

  89. Dismory  Reply to this comment

    那样的话,在feed里会不会没有标题

  90. underone  Reply to this comment

    不知道啊
    我在页面和feed里调用的相关文章是用不同的插件实现的

  91. Dismory  Reply to this comment

    呃...
    各用什么好?

  92. underone  Reply to this comment

    很常用的啊都是
    # WordPress Related Posts
    # Simple Tags
    随便你哪个用在页面,哪个用在feed都可以

  93. Dismory  Reply to this comment

    哦,谢过,simple tags可以设置的东西还蛮多的

  94. Dismory  Reply to this comment

    underone大,找了段tabs的代码,放进去后跟theme有点不搭..

  95. eqiuqiu  Reply to this comment

    老大,我装了你的G7V6,文章全部显示出来了,不能显示摘要。我看了好象安装“中文WordPress工具箱”就可以了,我的archive.php模板文件中就是the_excerpt(),但确不能显示摘要,实在是郁闷啊,大家帮帮小弟我吧,头都搞大了。

    我的部落格:www.eqiuqiu.com

  96. eqiuqiu  Reply to this comment

    我就想把自己的BLOG整得跟老大的一样,可我不知道还要装哪些插件,进行哪些设置,可否指点一二呀?
    如果老大没有时间,各位前辈们能不能帮帮我呢?感激不尽啊!

  97. thewise  Reply to this comment

    我是新手,选来选去,第一个主题就选的您的。感谢!
    想问下以下问题:
    1.标题的文字如何更改颜色和字体?
    2.导航栏如何将关于改成About,并追加一些分类链接,比如Sports, Music之类的?
    3.侧边栏的Feedsky,zhuaxia那些按钮如何实现?
    4.还有您侧边栏的一些东西,标签云什么的是如何实现的?
    最好如果有教材的话给个网址我可以自己去学。
    希望您不会觉得我烦并给予解答。多谢!

  98. thewise  Reply to this comment

    知道如何将关于改About,但如何将home改为Home?

  99. underone  Reply to this comment

    @thewise
    header.php中

    1. <ul><li><a href="<?php echo get_option('home'); ? rel="nofollow">/" title="<?php bloginfo('name'); ?>">home</a></li><?php wp_list_pages('title_li='); ?></ul>

    有home吧

    标题字体和颜色,修改.css文件中h2标签的属性

    侧边栏按钮是插件,叫wp_addbookmarks
    标签云也是插件,叫Simple Tags

  100. underone  Reply to this comment

    @eqiuqiu
    我看你已经正常显示摘要了
    http://www.eqiuqiu.com/?cat=13

    至于插件部分你可以看这个
    http://www.underone.com/2008/02/19/my-wordpress-plugins/

  101. underone  Reply to this comment

    @Dismory
    你在蓝色理想论坛找找看

  102. thewise  Reply to this comment

    谢谢这么晚了还回复。您侧边栏的最近评论是用的什么插件?我后台里默认的不能显示缩略的话。后台默认的标签云显示的也和您推荐的插件不一样,是不是都不要用默认的widges,而是去下载插件?

  103. som5  Reply to this comment

    很喜欢这个主题,只是有点问题,就是有些php文件另存为utf-8格式的,页面排版就出现问题了。

  104. underone  Reply to this comment

    这个主题的.php已经是utf-8格式的了。。

  105. underone  Reply to this comment

    @thewise
    评论插件是这个:
    http://wordpress.org/extend/plugins/wp-recentcomments/download/
    标签云是用插件实现的。

  106. som5  Reply to this comment

    重新下载了看了看,以下这几个文件是utf8格式的archive/comments/index/search/single
    其他的都不是utf8

  107. underone  Reply to this comment

    那可能传错了,怎么个变形法?
    我又本地全部存utf-8再上传了一次

  108. som5  Reply to this comment

    文件修改日期大都是今天13:16的,好像还是那样儿。可用记事本打开后,点另存为时,那个编码格式还是显示"ANSI"。但有写文件点另存为时就显示的'UTF-8',我很纳闷为什么改成utf-8会影响页面排版了,搞不懂是为什么。。不改编码格式吧,我又希望某些页面加汉字,不改utf-8会乱码.

  109. underone  Reply to this comment

    我建议你用editplus来打开和存储.php文件
    用记事本存php经常格式错乱

  110. som5  Reply to this comment

    好了,谢谢。
    用UE另存,但编码要选择:UTF-8 NO-BOM才行。
    选UTF-8保存后也是影响页面排版(网页,不是指代码排版)

  111. underone  Reply to this comment

    哦对,记得有人说过
    我一直用editplus,没这格式选项

  112. dickym  Reply to this comment

    帮慢看看。在回复别人评论时
    点reply。不弹出回复框。只是个空白的。也没有回复按钮。。

  113. underone  Reply to this comment

    你用的是回复插件吧,那可能会造成混乱,我也没用过所以不知道怎么改
    你可以先把表情插件关掉再试试

  114. dickym  Reply to this comment

    对的。是回复插件。就是偶爱偶家那个。
    我想知道有别人用这个主题而可以使用回复插件的吗?

  115. Dismory  Reply to this comment

    underone大,我问的都不好意思了…
    1个问题:
    wp-recentcomments这个plugin,修改core.php将管理员评论显示置为false后,真个插件所有的在页面上就没了,什么也不显示了...

  116. WordPress主题(Theme): G7v6 final发布 | 小肚生鱼汤  Reply to this comment

    [...] wordpressAug 2nd, 2008dickym cT="0";nc="#444444";nBgc="#FFF7DE";nBorder="#F5E5A9"; tc="#649B00";tBgc="#FFF4D0";tBorder="#F5E5A9"; tDigg="%E6%8E%A8%E8%8D%90";tDugg="%E5%B7%B2%E8%8D%90"; defaultItemUrl="http://www.xuedudou.cn/2008/08/02/g7v/";defaultFeedUrl ="http://www.xuedudou.cn/feed/"; 今天换上了G7v6 final,作者是默默的丸,几天前就看到要放出的消息,在等 [...]

  117. underone  Reply to this comment

    @Dismory
    那我还是建议你去问问插件作者。

  118. Dismory  Reply to this comment

    嗯…

  119. thewise  Reply to this comment

    试了很多次参数组合,还是无法让wp-recentcomments这个插件在页面中正常显示,无奈,只好求助于您。请告之一下您的配置:最大长度,头像尺寸,头像位置左OR右?导航按钮左OR右?

  120. underone  Reply to this comment

    我把插件代码贴出来得了:

    1. <?php
    2. /*
    3. Plugin Name: WP-RecentComments
    4. Plugin URI: http://wordpress.org/extend/plugins/wp-recentcomments/
    5. Plugin Description: Show the recent comments in your WordPress sidebar. 在 WordPress 的侧边栏显示最新评论。
    6. Version: 1.4.3
    7. Author: mg12
    8. Author URI: http://www.fighton.cn/
    9. */
    10.  
    11. /** core functions */
    12. include ('core.php');
    13.  
    14. /** l10n */
    15. load_plugin_textdomain('wp-recentcomments', "/wp-content/plugins/wp-recentcomments/languages/");
    16.  
    17. /**
    18.  * 打印最新评论列表
    19.  * @param args 参数字符串
    20.  */
    21. function wp_recentcomments( $args = '' ) {
    22. echo create_recentcomments( $args );
    23. }
    24.  
    25. /**
    26.  * 打印最新评论列表 (兼容老版本的方法, 不推荐使用)
    27.  * @param args 参数字符串
    28.  */
    29. function get_recentcomments( $args ) {
    30. echo wp_recentcomments( $args );
    31. }
    32.  
    33. // -- widget START ------------------------------------------------------------
    34.  
    35. /**
    36.  * 定义 Widget
    37.  * @param args 参数字符串
    38.  */
    39. function wp_widget_recentcomments($args) {
    40. if ( '%BEG_OF_TITLE%' != $args['before_title'] ) {
    41. if ( $output = wp_cache_get('widget_recentcomments', 'widget') ) {
    42. return print($output);
    43. }
    44. ob_start();
    45. }
    46.  
    47. extract($args);
    48. $options = get_option('widget_recentcomments');
    49. $title = empty($options['title']) ? __('Recent Comments', 'wp-recentcomments') : $options['title'];
    50.  
    51. // 转化参数
    52. $postParam = 'true';
    53. if ($options['post'] == 2) {
    54. $postParam = 'false';
    55. }
    56. $pingbackParam = 'true';
    57. if ($options['pingback'] == 2) {
    58. $pingbackParam = 'false';
    59. }
    60. $trackbackParam = 'true';
    61. if ($options['trackback'] == 2) {
    62. $trackbackParam = 'false';
    63. }
    64. $avatarParam = 'true';
    65. if ($options['avatar'] == 2) {
    66. $avatarParam = 'false';
    67. }
    68. $avatarpositionParam = 'left';
    69. if ($options['avatarposition'] == 2) {
    70. $avatarpositionParam = 'right';
    71. }
    72. $navigatorParam = 'true';
    73. if ($options['navigator'] == 2) {
    74. $navigatorParam = 'false';
    75. }
    76. $administratorParam = 'true';
    77. if ($options['administrator'] == 2) {
    78. $administratorParam = 'false';
    79. }
    80.  
    81. // 页面上打印
    82. echo $before_widget;
    83. echo $before_title . $title . $after_title;
    84. echo '<ul>';
    85. wp_recentcomments('limit=' . $options['number'] . '&length=' . $options['length'] . '&post=' . $postParam . '&pingback=' . $pingbackParam . '&trackback=' . $trackbackParam . '&avatar=' . $avatarParam . '&avatar_size=' . $options['avatarsize'] . '&avatar_position=' . $avatarpositionParam . '&avatar_default=' . $options['avatardefault'] . '&navigator=' . $navigatorParam . '&administrator=' . $administratorParam);
    86. echo '</ul>';
    87. echo $after_widget;
    88.  
    89. if ( '%BEG_OF_TITLE%' != $args['before_title'] ) {
    90. wp_cache_add('widget_recentcomments', ob_get_flush(), 'widget');
    91. }
    92. }
    93.  
    94. /*
    95.  * 清除缓存
    96.  */
    97. function wp_delete_recentcomments_cache() {
    98. wp_cache_delete( 'widget_recentcomments', 'widget' );
    99. }
    100. add_action( 'comment_post', 'wp_delete_recentcomments_cache' );
    101. add_action( 'wp_set_comment_status', 'wp_delete_recentcomments_cache' );
    102.  
    103. /**
    104.  * Widget 选项控制
    105.  */
    106. function wp_widget_recentcomments_control() {
    107. $options = $newoptions = get_option('widget_recentcomments');
    108. if ( $_POST["recentcomments-submit"] ) {
    109. $newoptions['title'] = strip_tags(stripslashes($_POST["recentcomments-title"]));
    110. $newoptions['number'] = (int) $_POST["recentcomments-number"];
    111. $newoptions['length'] = (int) $_POST["recentcomments-length"];
    112. $newoptions['post'] = (int) $_POST["recentcomments-post"];
    113. $newoptions['pingback'] = (int) $_POST["recentcomments-pingback"];
    114. $newoptions['trackback'] = (int) $_POST["recentcomments-trackback"];
    115. $newoptions['avatar'] = (int) $_POST["recentcomments-avatar"];
    116. $newoptions['avatarsize'] = (int) $_POST["recentcomments-avatarsize"];
    117. $newoptions['avatarposition'] = (int) $_POST["recentcomments-avatarposition"];
    118. $newoptions['avatardefault'] = strip_tags(stripslashes($_POST["recentcomments-avatardefault"]));
    119. $newoptions['navigator'] = (int) $_POST["recentcomments-navigator"];
    120. $newoptions['administrator'] = (int) $_POST["recentcomments-administrator"];
    121. }
    122. if ( $options != $newoptions ) {
    123. $options = $newoptions;
    124. update_option('widget_recentcomments', $options);
    125. wp_delete_recentcomments_cache();
    126. }
    127.  
    128. // 限定参数
    129. $title = attribute_escape($options['title']);
    130. if ( !$number = (int) $options['number'] ) {
    131. $number = 5;
    132. } else if ( $number < 1 ) {
    133. $number = 1;
    134. } else if ( $number > 20 ) {
    135. $number = 20;
    136. }
    137. if ( !$length = (int) $options['length'] ) {
    138. $length = 50;
    139. } else if ( $length < 10 ) {
    140. $length = 10;
    141. }
    142. if ( !$post = (int) $options['post']) {
    143. $post = 1;
    144. }
    145. if ( !$pingback = (int) $options['pingback']) {
    146. $pingback = 1;
    147. }
    148. if ( !$trackback = (int) $options['trackback']) {
    149. $trackback = 1;
    150. }
    151. if ( !$avatar = (int) $options['avatar']) {
    152. $avatar = 1;
    153. }
    154. if ( !$avatarsize = (int) $options['avatarsize'] ) {
    155. $avatarsize = 32;
    156. } else if ( $avatarsize < 8 ) {
    157. $avatarsize = 8;
    158. } else if ( $avatarsize > 96 ) {
    159. $avatarsize = 96;
    160. }
    161. if ( !$avatarposition = (int) $options['avatarposition']) {
    162. $avatarposition = 1;
    163. }
    164. $avatardefault = attribute_escape($options['avatardefault']);
    165. if ( !$navigator = (int) $options['navigator']) {
    166. $navigator = 1;
    167. }
    168. if ( !$administrator = (int) $options['administrator']) {
    169. $administrator = 1;
    170. }
    171.  
    172. // 后台选项的显示
    173. ?>
    174. <p>
    175. <label for="recentcomments-title">
    176. <?php _e('Title: ', 'wp-recentcomments'); ?>
    177. <input class="widefat" id="recentcomments-title" name="recentcomments-title" type="text" value="<?php echo $title; ?>" />
    178. </label>
    179. </p>
    180.  
    181. <p>
    182. <label for="recentcomments-number">
    183. <?php _e('Number of comments to show: ', 'wp-recentcomments'); ?>
    184. <input style="width: 25px;" id="recentcomments-number" name="recentcomments-number" type="text" value="<?php echo $number; ?>" />
    185. </label>
    186. <br />
    187. <small><?php _e('(at most 20)', 'wp-recentcomments'); ?></small>
    188. </p>
    189.  
    190. <p>
    191. <label for="recentcomments-length">
    192. <?php _e('Length of each comment: ', 'wp-recentcomments'); ?>
    193. <input style="width: 25px;" id="recentcomments-length" name="recentcomments-length" type="text" value="<?php echo $length; ?>" />
    194. </label>
    195. </p>
    196.  
    197. <p>
    198. <label for="recentcomments-post">
    199. <?php _e('Show post titles? ', 'wp-recentcomments'); ?>
    200. <select id="recentcomments-post" name="recentcomments-post" size="1">
    201. <option value="1" <?php if($post != 2) echo ' selected '; ?>>Yes</option>
    202. <option value="2" <?php if($post == 2) echo ' selected '; ?>>No</option>
    203. </select>
    204. </label>
    205. </p>
    206.  
    207. <p>
    208. <label for="recentcomments-pingback">
    209. <?php _e('Show pingback comments? ', 'wp-recentcomments'); ?>
    210. <select id="recentcomments-pingback" name="recentcomments-pingback" size="1">
    211. <option value="1" <?php if($pingback != 2) echo ' selected '; ?>>Yes</option>
    212. <option value="2" <?php if($pingback == 2) echo ' selected '; ?>>No</option>
    213. </select>
    214. </label>
    215. </p>
    216.  
    217. <p>
    218. <label for="recentcomments-trackback">
    219. <?php _e('Show trackback comments? ', 'wp-recentcomments'); ?>
    220. <select id="recentcomments-trackback" name="recentcomments-trackback" size="1">
    221. <option value="1" <?php if($trackback != 2) echo ' selected '; ?>>Yes</option>
    222. <option value="2" <?php if($trackback == 2) echo ' selected '; ?>>No</option>
    223. </select>
    224. </label>
    225. </p>
    226.  
    227. <p>
    228. <label for="recentcomments-avatar">
    229. <?php _e('Show author avatars? ', 'wp-recentcomments'); ?>
    230. <select id="recentcomments-avatar" name="recentcomments-avatar" size="1">
    231. <option value="1" <?php if($avatar != 2) echo ' selected '; ?>>Yes</option>
    232. <option value="2" <?php if($avatar == 2) echo ' selected '; ?>>No</option>
    233. </select>
    234. </label>
    235. </p>
    236.  
    237. <p>
    238. <label for="recentcomments-avatarsize">
    239. <?php _e('The size of avatars: ', 'wp-recentcomments'); ?>
    240. <input style="width: 25px;" id="recentcomments-avatarsize" name="recentcomments-avatarsize" type="text" value="<?php echo $avatarsize; ?>" />
    241. </label>
    242. <br />
    243. <small><?php _e('(8 - 96)'); ?></small>
    244. </p>
    245.  
    246. <p>
    247. <label for="recentcomments-avatarposition">
    248. <?php _e('The position of avatars: ', 'wp-recentcomments'); ?>
    249. <select id="recentcomments-avatarposition" name="recentcomments-avatarposition" size="1">
    250. <option value="1" <?php if($avatarposition != 2) echo ' selected '; ?>>Left</option>
    251. <option value="2" <?php if($avatarposition == 2) echo ' selected '; ?>>Right</option>
    252. </select>
    253. </label>
    254. </p>
    255.  
    256. <p>
    257. <label for="recentcomments-avatardefault">
    258. <?php _e('The default avatar: ', 'wp-recentcomments'); ?>
    259. <input style="width: 100px;" id="recentcomments-avatardefault" name="recentcomments-avatardefault" type="text" value="<?php if($avatardefault != ''){echo $avatardefault;} ?>" />
    260. </label>
    261. <br />
    262. <small><?php _e('(Filename from \'/wp-recentcomments/avatars/\' directory or Internet address)', 'wp-recentcomments'); ?></small>
    263. </p>
    264.  
    265. <p>
    266. <label for="recentcomments-navigator">
    267. <?php _e('Show navigator buttons? ', 'wp-recentcomments'); ?>
    268. <select id="recentcomments-navigator" name="recentcomments-navigator" size="1">
    269. <option value="1" <?php if($navigator != 2) echo ' selected '; ?>>Yes</option>
    270. <option value="2" <?php if($navigator == 2) echo ' selected '; ?>>No</option>
    271. </select>
    272. </label>
    273. </p>
    274.  
    275. <p>
    276. <label for="recentcomments-administrator">
    277. <?php _e('Show the comments from administrators? ', 'wp-recentcomments'); ?>
    278. <select id="recentcomments-administrator" name="recentcomments-administrator" size="1">
    279. <option value="1" <?php if($administrator != 2) echo ' selected '; ?>>Yes</option>
    280. <option value="2" <?php if($administrator == 2) echo ' selected '; ?>>No</option>
    281. </select>
    282. </label>
    283. </p>
    284.  
    285. <input type="hidden" id="recentcomments-submit" name="recentcomments-submit" value="1" />
    286. <?php
    287. }
    288.  
    289. /**
    290.  * 初始化 Widget
    291.  */
    292. function wp_widgets_recentcomments_init() {
    293. if ( !is_blog_installed() )
    294. return;
    295.  
    296. $widget_ops = array('classname' => 'widget_recentcomments', 'description' => __("The most recent comments", 'wp-recentcomments') );
    297. wp_register_sidebar_widget('recentcomments', __('WP-RecentComments', 'wp-recentcomments'), 'wp_widget_recentcomments', $widget_ops);
    298. wp_register_widget_control('recentcomments', __('WP-RecentComments', 'wp-recentcomments'), 'wp_widget_recentcomments_control' );
    299. }
    300.  
    301. /**
    302.  * 执行 Widget 初始化
    303.  */
    304. add_action('widgets_init', 'wp_widgets_recentcomments_init');
    305.  
    306. // -- widget END ------------------------------------------------------------
    307.  
    308. // -- head START ------------------------------------------------------------
    309.  
    310. /**
    311.  * 打印样式和脚本代码
    312.  */
    313. function recentcomments_head() {
    314. $css_url = get_bloginfo("wpurl") . '/wp-content/plugins/wp-recentcomments/wp-recentcomments.css';
    315. if ( file_exists(TEMPLATEPATH . "/wp-recentcomments.css") ){
    316. $css_url = get_bloginfo("template_url") . "/wp-recentcomments.css";
    317. }
    318. echo "\n" . '<!-- Start Of Script Generated By WP-RecentComment -->';
    319. echo "\n" . '<link rel="stylesheet" href="' . $css_url . '" type="text/css" media="screen&quo