WordPress给博客评论框添加一言随机语录

使用教程:

将代码放置到网站的header、footer等位置添加以下:【子比主题放置在后台自定义js中即可】

<script>
$.getJSON("https://cdn.ly522.com/yan.php?format=json",function(data){
$("#comment").text(data.text);
});
$(function(){
$("#comment").click(function() {
$(this).select();
})
})
</script>
<script>
$.getJSON("https://cdn.ly522.com/yan.php?format=json",function(data){
$("#comment").text(data.text);
});
$(function(){
$("#comment").click(function() {
$(this).select();
})
})
</script>
<script> $.getJSON("https://cdn.ly522.com/yan.php?format=json",function(data){ $("#comment").text(data.text); }); $(function(){ $("#comment").click(function() { $(this).select(); }) }) </script>

如果你设置不生效,查看一下你的主题中的评论框id不是comment,那就需要修改一下了。

查看id方法:首先右键评论框-审查元素-查看id或者class,选其一即可,之后把获取的id或者class替换到上述代码中的#conment

如果你自己有好的一言api,可以替换代码中的https一言接口地址。

效果图

WordPress给博客评论框添加一言随机语录插图
© 版权声明
THE END
喜欢点个赞支持一下吧
点赞0赏币 分享
Everyone has its disadvantage just like the god bites the apple. the bigger disadvantage you have, the more the god appreciate it.
每个人都会有缺陷,就像被上帝咬过的苹果,有的人缺陷比较大,正是因为上帝特别喜欢他的芬芳
评论交流 共1条

请登录后发表评论