我决定使用每个网站上提供的内置Facebook共享者和Twitter共享者链接。它不会提供完整的功能,但它非常适合作为一个简单的自定义图标。
Note: 这只能在“循环”内正常工作
要插入到页面模板中的HTML代码:
<div class="social_icons">
<a href="javascript:window.print()" target="_blank" class="printIcon">
Print page
</a>
<a href="https://www.facebook.com/sharer/sharer.php?u=<?php echo get_permalink(); ?>" target="_blank" class="facebookIcon">
Share on Facebook
</a>
<a href="https://twitter.com/share?text=<?php echo get_the_title(); ?>+–+" target="_blank" class="twitterIcon">
Tweet on Twitter
</a>
</div>
基本CSS样式:
.social_icons {
float: right; /*change for your specific needs*/
}
.social_icons a {
text-indent: -9999px;
height: 50px; /*change for your specific needs*/
display: block;
float: right; /*change for your specific needs*/
}
.social_icons a.printIcon {
background-image: url(); /*add a custom share icon*/
background-repeat: no-repeat;
}
.social_icons a.facebookIcon {
background-image: url(); /*add a custom share icon*/
background-repeat: no-repeat;
}
.social_icons a.twitterIcon {
background-image: url(); /*add a custom share icon*/
background-repeat: no-repeat;
}