wordpress弹窗通知_如何在WordPress中为您的客户添加警告通知

wordpress弹窗通知

As a consultant, developer, or designer, sometimes you just get hired to do the project and leave. Often in these circumstances, many developers customize the WordPress admin area and remove all the main settings options, so the client cannot break the site. However, it is really frustrating when another developer comes in just to find out that he has to take out bunch of code to see the settings. Or even if the owner decides they want to do things themselves, they don’t have the freedom to do so. The whole point of WordPress is to empower the publisher and give them freedom to publish content the way they want. Therefore in this article, we will show you how to give your clients full administrative access, but include warning notices for them, so they know the consequences of their actions. By simply hooking into WordPress admin_notices hook, we can display a notice that may say “Warning – changing settings on this page may cause problem with your website’s design”.

作为顾问,开发人员或设计师,有时您只是被雇用去做项目并离开。 通常,在这种情况下,许多开发人员自定义WordPress管理区域并删除所有主要设置选项,因此客户端无法破坏该站点。 但是,当另一个开发人员进来只是发现他必须拿出一大堆代码来查看设置时,这确实令人沮丧。 或者,即使所有者决定要自己做某事,他们也没有这样做的自由。 WordPress的全部目的是赋予发布者权力,让他们自由地按自己想要的方式发布内容。 因此,在本文中,我们将向您展示如何授予客户完整的管理访问权限,但包括对他们的警告通知,以便他们知道其操作的后果。 通过简单地插入WordPress admin_notices钩子,我们可以显示一条通知,其中可能显示“警告-更改此页面上的设置可能会导致您的网站设计出现问题”。

Warning Notices for your Clients in WordPress

First open your theme’s functions.php file, and then paste the following:

首先打开您主题的functions.php文件,然后粘贴以下内容:

add_action( 'admin_notices', 'my_admin_notice' );
function my_admin_notice(){
     global $current_screen;</div>
     if ( $current_screen->parent_base == 'options-general' )
          echo '<div><p>Warning - changing settings on these pages may cause problems with your website’s design!</p></div>';
}

You can modify the notices for each screen.

您可以修改每个屏幕的通知。

Thanks to Jacob Goldman for pointing this trick out. This will be great for our clients.

感谢Jacob Goldman指出这一技巧。 这将对我们的客户非常有用。

翻译自: https://www.wpbeginner.com/wp-tutorials/how-to-add-warning-notices-for-your-clients-in-wordpress/

wordpress弹窗通知

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值