post_excerpt) { $description = $post->post_excerpt; } else { $description = substr(strip_tags($post->post_content),0,220); } $keywords = ""; $tags = wp_get_post_tags($post->ID); foreach ($tags as $tag ) { $keywords = $keywords . $tag->name . ", "; } }?>

小改 Show Top Commentators, 及求助

最近琢磨着给评论相关的侧栏组件加上评论者自己的图像,由于 16x16 比较小不太适合用 Gravatar, 于是考虑更加简单的 favicon. 而最新评论当中没有留下网站地址的网友比较多,于是从侧栏上的 Show Top Commentators 下手,这个插件可以显示自定义时间内评论最多的网友链接。编辑该插件,几次测试之后确定了正确的修改方法,修改第 86 行(具体显示效果可能依赖于其他关于<li>的 css 定义):

echo $ns_options["start_html"];  //修改为:
echo "<li style='background-image: url(" . $url . "/favicon.ico)'>";

即用 $url 获取评论者的网站地址,将 /favicon.ico 作为列表图标。但是已知的问题有两个:没有 favicon, 或者 favicon 并不在默认地址。我用目前上榜的 5 个网友测试了一下,显示效果如下:

mercy kerby Geedr.com kaka Dickey
IE6 正确 正确
Opera 正确 正确
Firefox 正确 正确 正确 正确
 

其中 kaka 的路径错误,kerby 和 Dickey 的文件存在,但显示有有问题。对前一种情况,总不能去分析对方的 header 来获取吧,太不现实。后一种情况,我也没弄明白为什么… 或者,可以让获取错误的时候显示 css 里定义的默认列表图标?欢迎高手给指导一下 😛

最新评论

  • Shawna Kenyon Are you looking for powerful advertising that delivers real results? I apologize for sending you this message on your contact form but actually that was the whole point. We can send your ad copy to sites via their contact pages just like you're receiving this note right now. You can specify targets by keyword or just execute mass blasts to sites in the location of your choice. So let's say you're looking to push through an ad to all the mortgage brokers in the US, we'll scrape websites for just those and post your ad message to them. Providing you're advertising some kind of offer that's relevant to that type of business then you'll be blessed with an amazing response! Shoot me a reply to ethan3646hug@gmail.com for the details Greasemonkey 脚本推荐:在任何填邮箱的地方自动提示 Gmail 联系人
  • cheap jordan shoes I wish to show my gratitude for your generosity in support of people that should have help on this area. Your special commitment to getting the message all over had become incredibly good and has frequently allowed people much like me to achieve their targets. This useful useful information signifies this much to me and much more to my mates. Thank you; from all of us. Google 嵌入式日历重大更新
  • Fredericka McGuirk Need to find effective online promotion that isn't completely full of it? I apologize for sending you this message on your contact form but actually that was kinda the point. We can send your ad text to sites through their contact pages just like you're receiving this message right now. You can target by keyword or just start bulk blasts to websites in any country you choose. So let's say you want to push through an ad to all the contractors in the United States, we'll scrape websites for only those and post your ad message to them. As long as you're advertising a product or service that's relevant to that business category then your business will get awesome results! Write a quick note to evie2535gre@gmail.com to get info and prices Greasemonkey 脚本推荐:在任何填邮箱的地方自动提示 Gmail 联系人
  • 心灵博客 当年有这个效果已经很不错哦 diy 山寨投影家庭影院
  • 央街浪子 这个博客居然还在,真是老股东了。 我为什么爱 Twitter

发表您的评论

您的评论将回复给 原评论者

:D:):O8):(8D;DXD:P:nice::rainbow::cafe::love::cake:

目前有 14 条评论

  

不错哦,很高兴能上榜 🙂
虽然我的favicon在默认地址,但是不知道为什么在我的Blog的存档页面里是不会显示favicon的....

btw,可以的话交换下链接吧 🙂


fisio 回复: done~ 😀

😮 太强了,你这个还可以显示favicon---

很多人的Favicon都不在根目录哦...

嘿嘿嘿,评论一下第五位就变成我的了


fisio 回复: 我k...赶紧去把你的 icon 最大尺寸改为 16x16... 👿

这个想法很好,可是一般只有独立博客的favicon才会放在根目录,BSP如yo2只会用路径来指定,就不好获取了。yo2的每个用户的favicon路径好像是比较固定的,你看看能不能写一个函数把路径选择出来。


fisio 回复: 如果要根据对方 header 里面的信息来,就太复杂了,我搞不定.. 不过 yo2 是没问题的,上传的 favicon 都会自动映射到根目录,你可以找个 yo2 用户试试看 😀

不对啊,昨天看的时候还是16*16的啊,今天怎么变成这个大一坨?


fisio 回复: 昨天我就发现了 IE6 下有这个问题,让你改最大尺寸为16x16来着=.=

我的Favicon的确是32*32的,刚才在IE下,所以看到了丑恶的一幕.IE太傻了...

OK,上传完毕,心情舒畅了 👿

厉害

测试一下

强悍,这是我见到的第一个在评论榜显示头像的博客,不错!


fisio 回复: 呵呵,谢谢~ 😀

嘿嘿,我也学你改了下 😀

这个功能不错,可以吸引更多的回头客


有 1 篇其他博客的文章引用了本文

  1. 08年9月7日Shawn's Blog ishawn.net/my-blog-related/show-commentors-favicon-of-wordpress.html