WordPress日志文章分享 无需插件 代码实现

无插件实现WordPress日志文章分享 支持主流 SNS、日志收藏夹,代码实现 可调 可控
国外关于WordPress日志分享的插件很多,比如分享到digg、twitter、Facebook等,
关于国内分享的插件较少,且功能比较单一…
分享不一定需要插件才能实现,下面分享一个用代码分享日志文章到国内比较出名的SNS、
收藏夹、微薄等平台的方法。支持新浪、开心、人人、白社会、豆瓣、qq等等……

插入代码用的div方法
ico标志可以从这里 下载
代码通常插入的到single.php和page.php 中;插入的位置一般是留言的前面。
“<?php comments_template(); ?>”

代码如下:

<div id=”myshare”><br /><br />分享到: <a href=”http://v.t.sina.com.cn/share/share.php?url=<?php echo urlencode(get_permalink($post->ID));?>&title=<?php echo urlencode($post->post_title);?>&source=&sourceUrl=” target=”_blank”><img src=”http://你的favicons图标链接路径/sina.ico” alt=”sina” title=”新浪微博” />新浪微博</a> <a href=”http://www.kaixin001.com/repaste/share.php?rtitle=<?php echo urlencode($post->post_title);?>&rurl=<?php echo urlencode(get_permalink($post->ID));?>&rcontent=” target=”_blank”><img src=”http://你的favicons图标链接路径/kaixin001.ico” alt=”开心” title=”开心” />开心网</a>

<a href=”http://share.renren.com/share/buttonshare.do?link=<?php echo urlencode(get_permalink($post->ID));?>&title=<?php echo urlencode($post->post_title);?>” target=”_blank”><img src=”http://你的favicons图标链接路径/renren.ico” alt=”人人网” title=”人人网” />人人网</a>

<a href=”http://bai.sohu.com/appLogin.jsp?border=1&bru=/share/blank/add.do?link=<?php echo urlencode(get_permalink($post->ID));?>” target=”_blank”><img src=”http://你的favicons图标链接路径/bai.ico” alt=”白社会” title=”白社会” />白社会</a>

<a href=”http://www.douban.com/recommend/?url=<?php echo urlencode(get_permalink($post->ID));?>&title=<?php echo urlencode($post->post_title);?>” target=”_blank”><img src=”http://你的favicons图标链接路径/douban.ico” alt=”豆瓣” title=”豆瓣” />豆瓣</a>

<a href=”http://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?url=<?php echo urlencode(get_permalink($post->ID));?>” target=”_blank”><img src=”http://你的favicons图标链接路径/qzone.ico” alt=”QQ空间” title=”QZone” />QQ空间</a>

<br /><br />

收藏到: <a target=”_blank” href=”http://shuqian.qq.com/post?from=1&jumpback=2&noui=1&title=<?php echo urlencode($post->post_title);?>&description=&uri=<?php echo urlencode(get_permalink($post->ID));?>”><img alt=”QQ书签” title=”QQ书签” src=”http://你的favicons图标链接路径/qqshuqian.ico”/>QQ书签</a>

<a target=”_blank” href=”http://www.google.com/bookmarks/mark?op=add&bkmk=<?php echo urlencode(get_permalink($post->ID));?>&labels=louishan”><img alt=”Google” title=”Google Bookmarks” src=”http://你的favicons图标链接路径/google.ico”/>Google书签</a>

<a href=”http://cang.baidu.com/do/add?it=<?php echo urlencode($post->post_title);?>&iu=<?php echo urlencode(get_permalink($post->ID));?>&dc=” target=”_blank”><img src=”http://你的favicons图标链接路径/baidu.ico” alt=”百度搜藏” title=”百度搜藏” />百度搜藏</a>

<a href=”http://shuqian.youdao.com/manage?a=popwindow&title=<?php echo urlencode($post->post_title);?>&url=<?php echo urlencode(get_permalink($post->ID));?>” target=”_blank”><img src=”http://你的favicons图标链接路径/youdao.ico” alt=”youdao” title=”有道书签” />有道书签</a>

<a href=”http://myweb.cn.yahoo.com/popadd.html?url=<?php echo urlencode(get_permalink($post->ID));?>&title=<?php echo urlencode($post->post_title);?>” target=”_blank”><img src=”http://你的favicons图标链接路径/yahoo.ico” alt=”雅虎收藏” title=”雅虎收藏” />雅虎收藏</a>

<a href=”https://skydrive.live.com/sharefavorite.aspx/.SharedFavorites??marklet=1&url=<?php echo urlencode(get_permalink($post->ID));?>&&title=<?php echo urlencode($post->post_title);?>” target=”_blank”><img src=”http://你的favicons图标链接路径/msn.ico” alt=”Live Favorite” title=”Live Favorite” />MSN收藏</a>

<a href=”http://vivi.sina.com.cn/collect/icollect.php?pid=louishan.com&title=<?php echo urlencode($post->post_title);?>&url=<?php echo urlencode(get_permalink($post->ID));?>&desc=” target=”_blank”><img src=”http://你的favicons图标链接路径/vivi.ico” alt=”新浪 Vivi” title=”新浪 Vivi” />新浪VIVI</a>

<br /><br />

推荐到: <a href=”http://www.douban.com/recommend/?url=<?php echo urlencode(get_permalink($post->ID));?>&title=<?php echo urlencode($post->post_title);?>&sel=&v=1&n=1″ target=”_blank”><img src=”http://你的favicons图标链接路径/9.ico” alt=”豆瓣九点” title=”豆瓣九点” />豆瓣九点</a>

<a href=”http://www.xianguo.com/service/submitdigg/?link=<?php echo urlencode(get_permalink($post->ID));?>&title=<?php echo urlencode($post->post_title);?>” target=”_blank”><img src=”http://你的favicons图标链接路径/xianguo.ico” alt=”鲜果” title=”鲜果” />鲜果</a>

<a href=”http://www.diglog.com/submit.aspx?title=<?php echo urlencode($post->post_title);?>&url=<?php echo urlencode(get_permalink($post->ID));?>&description=” target=”_blank”><img src=”http://你的favicons图标链接路径/diglog.ico” alt=”奇客发现” title=”奇客发现” />奇客发现</a>

<a href=”http://my.poco.cn/fav/storeIt.php?t=<?php echo urlencode($post->post_title);?>&u=<?php echo urlencode(get_permalink($post->ID));?>&c=<?php echo urlencode($post->post_title);?>&img=” target=”_blank”><img src=”http://你的favicons图标链接路径/poco.ico” alt=”POCO” title=”POCO.CN” />POCO</a>

<a href=”http://www.myspace.cn/Modules/PostTo/Pages/Default.aspx?t=<?php echo urlencode($post->post_title);?>&c=&u=<?php echo urlencode(get_permalink($post->ID));?>” target=”_blank”><img src=”http://你的favicons图标链接路径/Myspace.ico” alt=”MySpace.CN” title=”聚友网络” />Myspace</a>

<a href=”mailto:?subject=<?php echo urlencode($post->post_title);?>&body=<?php echo urlencode(get_permalink($post->ID));?>” target=”_blank”><img src=”http://你的favicons图标链接路径/email.ico” alt=”Sent Mail” title=”发送邮件” />发送邮件</a> </div>

可以对插入的div模块进行css设置:
#myshare{
font-size: 12px;
font-weight: bold;
float: none;
margin: 10px 0pt;
text-align: center;
}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值