gocodebox/banner-notifications
最新稳定版本:1.1.1
Composer 安装命令:
composer require gocodebox/banner-notifications
包简介
Library for showing admin-area banner notices.
README 文档
README
WordPress Editor (Gutenberg) blocks for LifterLMS.
Installing
TBW
- Adding notification area in admin header
<?php // Default to showing notification banners. $show_notifications = true; // Hide notifications on certain pages. $hide_on_these_pages = array( 'pmpro-updates' ); if ( ! empty( $_REQUEST['page'] ) && in_array( sanitize_text_field( $_REQUEST['page'] ), $hide_on_these_pages ) ) { $show_notifications = false; } // Hide notifications if the user has disabled them. if( pmpro_get_max_notification_priority() < 1 ) { $show_notifications = false; } if( $show_notifications ) : ?> <div id="pmpro_notifications"> </div> <?php // To debug a specific notification. if ( !empty( $_REQUEST['pmpro_notification'] ) ) { $specific_notification = '&pmpro_notification=' . intval( $_REQUEST['pmpro_notification'] ); } else { $specific_notification = ''; } ?> <script> jQuery(document).ready(function() { jQuery.get('<?php echo esc_url_raw( admin_url( "admin-ajax.php?action=pmpro_notifications" . $specific_notification ) ); ?>', function(data) { if(data && data != 'NULL') jQuery('#pmpro_notifications').html(data); }); }); </script> <?php endif; ?>
- Loading an instance of the class with unique slug (ie. for the )
$GLOBALS['pmpro_banner_notifications'] = new Gocodebox_Banner_Notifier( array(
'prefix' => 'pmpro',
'version' => PMPRO_VERSION,
'notifications_url' => 'https://notifications.paidmembershipspro.com/v2/notifications.json'
) );
Development
TBW
统计信息
- 总下载量: 1.35k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: GPL-2.0-or-later
- 更新时间: 2025-05-26