先说自己,从一开始,我就是基本不做链接啥的,以前有过两个,都是高中同学的博客,顺手加上了,其它的从来没有加过。我一直觉去追求外联PR,完全失去写博客的意思,所以也不去跟风到处留言说啥“xxx,欢迎回访”、“xxx做个链接”啥的。对于感兴趣的博客,我从来都是一键订阅之。不过,我也承认以前经常潜水,去很多博客闲逛,轻轻地来,悄悄地走。又比如在别人那里“拿了”一些分享的代码走了,从不留言。。好吧,现在我改正了,到处留下废话,水水更健康~~

关于链接的事也稍微改变一下,因为最近比较流行“暗链”,感兴趣的博客自己就给加上了。偶然发现万戈那里内页有我的链接,还有似飘若舞,那我也加上吧,礼尚往来,一个人暗恋多没意思。

具体方式不打算按原来的链接,一个个加太辛苦,还是弄个热评榜比较简单,我只需要关注经常过来的朋友,输出的是链接地址加头像,没有no-follow,也放在内页吧。说白了其实还是水墙,我只是写了个模板,命名为page-link.php,具体不一样的地方是,只显示3个月内留言超过3条的朋友,代码很简单:

<?php
$exclude_emails = array('xx@xxx.com','');//希望被排除的email请添加到此数组中
$imgsize = 40;//头像大小,单位px
global $imgsize ;
global $exclude_emails;
//$cur_time_span = date('Y-m-d H:i:s', strtotime('-1 week'));
//$cur_time_span = date('Y-m-d H:i:s', strtotime('-1 Month')) ;
$cur_time_span = date('Y-m-d H:i:s', strtotime('-3 Month'));//3个月
//$cur_time_span = date('Y-m-d H:i:s', strtotime('-1 Year'));

	global $wpdb;
	$request = "SELECT count(comment_ID) comment_nums,comment_author, comment_author_email,comment_author_url   FROM  {$wpdb->prefix}comments where comment_date>'".$cur_time_span."' AND comment_type='' AND comment_approved=1 AND comment_author_url != '' group by comment_author_email order by count(comment_ID) DESC ";

	$comments = $wpdb->get_results($request);
  $output='';
    foreach ($comments as $comment) {
		if (in_array($comment->comment_author_email, $exclude_emails)||$comment->comment_nums <=3 )  continue;
		if( $comment->comment_author_url ) $url = $comment->comment_author_url;
		else $url="#";
		$output .= "<a href='".$url."' title='".$comment->comment_author." (".$comment->comment_nums.")'>".get_avatar($comment->comment_author_email,$imgsize)."</a>";

       }

	$output = "<div class='wall' style='padding:2px 25px;'>".$output."</div>";
echo $output;
?>

也就排除了有些只来一次,留个言,就为了骗个IP的人,我觉得这个频率要求很低吧,3个月不来也就没啥交流了。嗯,还有自动更新也方便,适合偷懒的淫~

经常互访这才是友情啊,链接只是其次。我这里没什么PR,也是小站,只是方便取串门,只是“暗恋”也没关系。(其实也没人气~~

p_large_K8Xm_113e00000baa2d13

8.17 update:是说没url的给处理成#了,那排除掉吧,更新下代码:

<?php
$exclude_emails = array('xxx@xxx.com','');//希望被排除的email请添加到此数组中
$imgsize = 40;//头像大小,单位px
global $imgsize ;
global $exclude_emails;
//$cur_time_span = date('Y-m-d H:i:s', strtotime('-1 week'));
//$cur_time_span = date('Y-m-d H:i:s', strtotime('-1 Month')) ;
$cur_time_span = date('Y-m-d H:i:s', strtotime('-3 Month'));
//$cur_time_span = date('Y-m-d H:i:s', strtotime('-1 Year'));

	global $wpdb;
	$request = "SELECT count(comment_ID) comment_nums,comment_author, comment_author_email,comment_author_url   FROM  {$wpdb->prefix}comments where comment_date>'".$cur_time_span."' AND comment_type='' AND comment_approved=1 AND comment_author_url != '' group by comment_author_email order by count(comment_ID) DESC ";

	$comments = $wpdb->get_results($request);
  $output='';
    foreach ($comments as $comment) {
		if (in_array($comment->comment_author_email, $exclude_emails)||$comment->comment_nums <=3 || $comment->comment_author_url==''  )  continue;
		$url = $comment->comment_author_url;
		$output .= "<a href='".$url."' title='".$comment->comment_author." (".$comment->comment_nums.")'>".get_avatar($comment->comment_author_email,$imgsize)."</a>";

       }

	$output = "<div class='wall' style='padding:2px 25px;'>".$output."</div>";
echo $output;
?>
  1. Minimalist Shoes (2011.05.16 at 16:11) 65楼

    礼尚往来!

  2. 时尚巴拉 (2011.07.01 at 16:29) 66楼

    在这里拿了代码,那我就得把脸搁着了~~

  3. 淘博客 (2011.10.21 at 17:47) 67楼

    这个很有个性啊,值得参考

评论分页: 1 ... 7 8 9

发布评论

邮箱(必填)

换个背景