很多站长在使用WordPress的时候会遇到没完成编辑就不小心点击了发布按钮,虽然影响不大,但是等发布后可以继续编辑,但是对于一些站长而言,是不能忍受的,那么在WordPress发布文章时跳出弹窗确认提示方法是什么?

下面是实现代码,加入到主题的 functions.php 中即可。

//WordPress发布文章弹窗提示

function publish_confirm() {

echo \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\”

<script>

jQuery(document).ready(function($){

$(\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’#publishing-action input[name=\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\”publish\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\”]\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’).click(function() {

if(confirm(\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’确定现在发布文章吗?\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’)) {

return true;

} else {

$(\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’#publishing-action .spinner\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’).hide();

$(\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’#publishing-action img\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’).hide();

$(this).removeClass(\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’button-primary-disabled\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’);

return false;

}

});

});

</script>\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\”;

}

//add_action(\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’admin_footer-post.php\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’, \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’publish_confirm\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’);//文章修改等页面加载

add_action(\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’admin_footer-post-new.php\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’, \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’publish_confirm\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’);//文章发表页面加载

//add_action( \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’admin_print_footer_scripts\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’, \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’publish_confirm\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’ );//所有后台底部加载

相关新闻

发表评论

您的电子邮箱地址不会被公开。 必填项已用*标注

联系我们

联系我们

151-1101-0018

在线咨询:
邮件:30115776@qq.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信
关注微信
分享本页
返回顶部