wpscholar/wp-transient-admin-notices 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

wpscholar/wp-transient-admin-notices

Composer 安装命令:

composer require wpscholar/wp-transient-admin-notices

包简介

Display admin notices in WordPress after a page redirect or reload.

README 文档

README

Handles the display of admin notices in WordPress after a page redirect or reload.

Details

When creating a new instance of TransientAdminNotices, you will need to provide a transient name. This is used as either the cache key, when caching is enabled, or the database option name, if caching isn't an option. If you're notice is user-specific, be sure to scope your transient name to the user.

Ensure that you instantiate the class on the admin_init hook. This ensures that the class can automatically setup a hook to render your notices on the admin_notices hook and that it only runs in the WordPress admin. Note that you must create an instance, even if you are not adding new notices, in order for notices from a previous page load to display.

All notices added to your instance require a key, the message you want to display, and the notice type. The key can be any string you want and can be used to later get or remove that specific notice from the queue.

Notice Types

These notice types are the types provided by WordPress, but can be passed in to the add() method to customize how your notices will display.

  • success - Displays with a green bar
  • info - Displays with a blue bar (default)
  • warning - Displays with an orange bar
  • error - Displays with a red bar

Sample Usage

<?php 

use wpscholar\WordPress\TransientAdminNotices;

add_action( 'admin_init', function() {
	
    $transient_name = md5( 'my_plugin' . get_current_user_id() );
    $notices = new TransientAdminNotices( $transient_name );
    
    if( ! $user_has_account ) {
        $notices->add( 'msg1', 'Looks like you have not created an account yet!', 'warning' );
    }
    
} );

wpscholar/wp-transient-admin-notices 适用场景与选型建议

wpscholar/wp-transient-admin-notices 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 34 次下载、GitHub Stars 达 5, 最近一次更新时间为 2017 年 11 月 02 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 wpscholar/wp-transient-admin-notices 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 wpscholar/wp-transient-admin-notices 我们能提供哪些服务?
定制开发 / 二次开发

基于 wpscholar/wp-transient-admin-notices 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 34
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 5
  • 点击次数: 4
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 5
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: GPL-2.0
  • 更新时间: 2017-11-02