本内容来自:SEO校内 想要了解更多的网站建设资料
如果是经常上网的网虫对于Digg估计是在熟悉不过了,这个在国外名气非常大的内容分享平台。我们利用它也可以进行一些优化,可以鼓励访问者挖掘已经被挖掘的文章。
针对这个插件下载地址http://www.seoegghead.com/blog/seo/how-to-get-dugg-gigg-for-wordpress-plugin113.html。
在博客中添加DIGG按钮需要以下步骤:
(1)在BLOG插件文件夹下创建文件 digg-button.php,然后加入下面的代码:
<?php
/*
Plugin Name: Digg
Plugin URI: http://www.seoegghead.com/
Description: Creates an interactive Digg button.
Author: Jaimie Sirovich
Version: 1.0
Author URI: http://www.seoegghead.com/
*/
function _scrape_check_digg($digg_link, $the_permalink)
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $digg_link);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$http_result = curl_exec($ch);
curl_close($ch);
$_ = preg_match('#<h3 id="title"><a href="(.*?)">#is', $http_result, $captures);
return ($captures[1] == $the_permalink);
}
function digg_this()
{
global $id;
$digg_link = get_post_meta($id, 'DIGG_CLASS_digg_link', true);
if (is_single() && !$digg_link && preg_match('#^http://(www\.)?digg\.com/.+#i', $_SERVER['HTTP_REFERER']) && !preg_match('#^http://(www\.)?digg\.com/(view|users)#i', $_SERVER['HTTP_REFERER']) && _scrape_check_digg($_SERVER['HTTP_REFERER'], get_permalink())) {
add_post_meta($id, 'DIGG_CLASS_digg_link', $_SERVER['HTTP_REFERER']);
$digg_link = $_SERVER['HTTP_REFERER'];
}
if ($digg_link) {
?><iframe src='http://digg.com/api/diggthis.php?u=<?php echo urlencode($digg_link)?>' height='82' width='55' frameborder='0' scrolling='no'></iframe><?php
}
}
?>
(2)加载管理页面,进入插件部分,激活插件Digg。
(3)在模板中希望放置Digg按钮的地方,调用digg_tish()函数。例如,可以在模板中的文件index.php中希望显示Digg地方,放置下面代码:
<?php digg_this(); ?>
资料来源:《搜索引擎优化高级编程》
了解一下更多关于WordPress插件参看:利用WordPress创建一个良好SEO博客
本内容欢迎转载,请注明链接!