流量小,请求互加[友情]链接也会比较少.网站访问人多了, 自然请求就会越来越多.我在 这篇文章里 表达了暂时不想加入这么一个页面的意思.因为三天两头要添加,很乱,很麻烦.
网站越来越多留言,但是留言在页面的链接是被自动加入 [rel = external no follow] 的 HTML 标记,也就是说不会对搜索引擎SEO产生任何影响.但是我又想鼓励大家勇跃参于讨论,于是我想了一个方法.也就是创建这么一个页面 用于统计留言次数最多的前十名评论者.暂时十名, 以后根据留言数目,等流量上去了再扩大也不迟.
这个页面的好处是,可以查看哪个博主的[友情]最深,并且可以根据这个自动加入友情链接.
如何做的?
技术部分,很简单,只需要先下载一个插件 (Simple Include PHP and HTML) 然后创建一个页面, 代码如下:
然后到主题的目录下,添加这个 cmt.php 代码如下 (PHP+MySQL 就是强大啊) [同步到英文博客]
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | <?php // https://codingforspeed.com global $wpdb; $query = " select `comment_author`, `comment_author_url`, count(1) as `cnt` from `wp_comments` where `comment_approved` = 1 group by `comment_author` order by `cnt` desc limit 10 "; $result = $wpdb->get_results($query); if ($result) { echo "<table width='100%' style='border:0'>"; echo "<tr><b><td>作者</td><td>评论数目</td></b></tr>"; foreach ($result as $author) { echo "<tr>"; $a = esc_sql($author->comment_author); $query = " select `comment_post_id`, `comment_id` from `wp_comments` where `comment_approved` = 1 and `comment_author` = '$a' order by `comment_date` desc limit 1 "; $latest = $wpdb->get_row($query); echo "<td><a href='$author->comment_author_url' target='_blank' title='$author->comment_author'>".$author->comment_author."</a></td>"; echo "<td><a title='$author->comment_author' href='/archives/$latest->comment_post_id/#comment-$latest->comment_id'>".$author->cnt."</a></td>"; echo "</tr>"; } echo "</table>"; } ?> |
<?php // https://codingforspeed.com global $wpdb; $query = " select `comment_author`, `comment_author_url`, count(1) as `cnt` from `wp_comments` where `comment_approved` = 1 group by `comment_author` order by `cnt` desc limit 10 "; $result = $wpdb->get_results($query); if ($result) { echo "<table width='100%' style='border:0'>"; echo "<tr><b><td>作者</td><td>评论数目</td></b></tr>"; foreach ($result as $author) { echo "<tr>"; $a = esc_sql($author->comment_author); $query = " select `comment_post_id`, `comment_id` from `wp_comments` where `comment_approved` = 1 and `comment_author` = '$a' order by `comment_date` desc limit 1 "; $latest = $wpdb->get_row($query); echo "<td><a href='$author->comment_author_url' target='_blank' title='$author->comment_author'>".$author->comment_author."</a></td>"; echo "<td><a title='$author->comment_author' href='/archives/$latest->comment_post_id/#comment-$latest->comment_id'>".$author->cnt."</a></td>"; echo "</tr>"; } echo "</table>"; } ?>
你们觉得这样的功能是不是好些呢?
后注:坛子说, 这个其实就是读者墙的功能,但是那个是插件实现的,略为有点复杂.而且说不定读者墙的链接也是 nofollow 的.这个页面能保证排名榜上的链接都是真正意义上的 [友情] 链接.
强烈推荐
- 英国代购-畅购英伦
- TopCashBack 返现 (英国购物必备, 积少成多, 我2年来一共得了3000多英镑)
- Quidco 返现 (也是很不错的英国返现网站, 返现率高)
- 注册就送10美元, 免费使用2个月的 DigitalOcean 云主机(性价比超高, 每月只需5美元)
- 注册就送10美元, 免费使用4个月的 Vultr 云主机(性价比超高, 每月只需2.5美元)
- 注册就送10美元, 免费使用2个月的 阿里 云主机(性价比超高, 每月只需4.5美元)
- 注册就送20美元, 免费使用4个月的 Linode 云主机(性价比超高, 每月只需5美元) (折扣码: PodCastInit2022)
- PlusNet 英国光纤(超快, 超划算! 用户名 doctorlai)
- 刷了美国运通信用卡一年得到的积分 换了 485英镑
- 注册就送50英镑 – 英国最便宜最划算的电气提供商
- 能把比特币莱特币变现的银行卡! 不需要手续费就可以把虚拟货币法币兑换
微信公众号: 小赖子的英国生活和资讯 JustYYUK