1.引入Share.js 项目https://github.com/overtrue/share.js
将<link rel=”stylesheet” href=”https://cdnjs.cloudflare.com/ajax/libs/social-share.js/1.0.16/css/share.min.css”>
<script src=”https://cdnjs.cloudflare.com/ajax/libs/social-share.js/1.0.16/js/social-share.min.js”></script>放到footer.php中
2.找到/wp-content/themes/onenav/inc/functions/io-single-post.php文件,搜索echo ‘<div class=”text-xs text-muted”><div><span>©</span> ‘.__(‘版权声明’,’i_theme’).'</div><div class=”posts-copyright”>’ . $copy . ‘</div></div>’;在下面添加echo ‘<div class=”fenxiang”><div class=”social-share”></div></div>’;
3.给分享按钮位置写个样式,这一步根据自己的需求来调整,我分享的是本站的位置css样式
找到/wp-content/themes/onenav/assets/css中的bootstrap.min.css,在最下面写入.fenxiang {float: right;}
这是PC端的,移动端同样找到/wp-content/themes/onenav/assets/css中的main.min.css,在最下面加上@media only screen and (max-width:767.98px){
.donate-button-container {text-align: center;}
}
4.至此大功告成,去看效果吧,记得清除缓存再查看喔!
5.来源:https://wzlingdi.com/771.html 效果也请去这个链接看,如你有更好的分享按钮请再次分享,一起谈论研究!