moderntribe/tribe-alerts
Composer 安装命令:
composer require moderntribe/tribe-alerts
包简介
Tribe Alerts WordPress Plugin
README 文档
README
Displays a customizable banner on that screen and remembers when users have dismissed it.
Display custom banner alerts on your website.
Requirements
- php7.4+
- Advanced Custom Fields Pro
- nvm or fnm
- node 16+
- yarn 1.22+
- npm 8.3+
Quick Start First Run
- Install SquareOne Docker (so)
- Run:
so bootstrap - Run:
nvm use - Run:
yarn install - Run:
yarn mix - Activate your plugins in the WordPress dashboard and start developing!
Pull Requests / Building
Ensure you run yarn prod before submitting a PR to ensure the resources/dist folder is updated with the latest build.
Front end
Front end building is powered by Laravel Mix.
Building
nvm use
yarn install
Usage
Build for development:
yarn dev
Watch for file changes:
yarn watch
Poll for file changes:
yarn watch-poll
Watch with hot module replacement:
yarn hot
Build for production:
yarn production
See more options: yarn mix --help
Installing this plugin
Every published release automatically creates a tribe-alerts.zip which is a fully built and vendor scoped WordPress plugin, about a minute after the release is published. To manually install, visit a release and download and extract the zip in your WordPress plugins folder.
Composer
The best way to include the release zip is by using the fantastic ffraenz/private-composer-installer plugin.
Add a custom repository to your project's repository key in composer.json:
"repositories": [ { "type": "package", "package": { "name": "moderntribe/tribe-alerts", "version": "1.1.0", "type": "wordpress-plugin", "dist": { "type": "zip", "url": "https://github.com/moderntribe/tribe-alerts/releases/download/{%VERSION}/tribe-alerts.zip" }, "require": { "ffraenz/private-composer-installer": "^5.0" } } }, ],
NOTE: Simply update the version above and run
composer updateto upgrade the plugin in the future.
Then, add the plugin definition to the require section:
"require": { "moderntribe/tribe-alerts": "*", }
Tell composer where to put your WordPress plugins/themes via the extra section.
NOTE: Adjust the paths based on your project.
"extra": { "wordpress-install-dir": "wp", "installer-paths": { "wp-content/mu-plugins/{$name}": [ "type:wordpress-muplugin" ], "wp-content/plugins/{$name}": [ "type:wordpress-plugin" ], "wp-content/themes/{$name}": [ "type:wordpress-theme" ] } },
You may have to allow this plugin in your config as well:
"allow-plugins": { "composer/installers": true, "ffraenz/private-composer-installer": true, }
Finally, install the plugin:
composer update
Displaying an Alert
The banner is set to automatically display using the wp_footer hook. If you need to manually add it to a theme or a plugin, add the following code to render the alert view:
<?php if ( function_exists( '\Tribe\Alert\tribe_alert' ) && function_exists( '\Tribe\Alert\render_alert' ) ) { \Tribe\Alert\render_alert(); } ?>
You can hide the automatic wp_footer output by defining the following in your wp-config.php:
define( 'TRIBE_ALERTS_AUTOMATIC_OUTPUT', false );
Customize The Alert View Markup
You can filter the directory where we look for view files, e.g.
add_filter( 'tribe/alerts/view_directory', static fn ( string $directory ) => get_stylesheet_directory() . '/components/alerts', 10, 1 );
And then copy the resources/views/alert.php to your specified folder and customize as needed.
ACF Swatch Field Options
Color options are disabled by default. You can enable it by defining the following in your wp-config.php:
define( 'TRIBE_ALERTS_COLOR_OPTIONS', true );
Filter the color options provided to the ACF swatch field:
add_filter( 'tribe/alerts/color_options', static fn ( array $options ) => [ '#880ED4' => [ 'name' => esc_html__( 'Purple', 'tribe-alerts' ), 'class' => 'purple-mono', ], '#8155BA' => [ 'name' => esc_html__( 'Violet', 'tribe-alerts' ), 'class' => 'violet', ], '#323E42' => [ 'name' => esc_html__( 'Charcoal', 'tribe-alerts' ), 'class' => 'charcoal', ], ], 10, 1 );
The default CSS class prefix for the color theme is tribe-alerts__theme, which ends up being tribe-alerts__theme-$name once a color is selected.
Filter the CSS class prefix:
add_filter( 'tribe/alerts/color_options/css_class_prefix', static fn ( string $prefix ) => 'new-prefix', 10, 1 );
Credits
- Based on Spatie Skeleton
License
GNU General Public License GPLv2 (or later). Please see License File for more information.
Modern Tribe
moderntribe/tribe-alerts 适用场景与选型建议
moderntribe/tribe-alerts 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 263 次下载、GitHub Stars 达 0, 最近一次更新时间为 2022 年 04 月 20 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「modern tribe」 「tribe-alerts」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 moderntribe/tribe-alerts 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 moderntribe/tribe-alerts 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 moderntribe/tribe-alerts 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
MailSpy is a Laravel package that allows you to capture and inspect emails sent by your application. It was created to help with testing and debugging email sending in Laravel applications in addition to getting around low retention log limits in services like MailGun and MailerSend.
A set of modern PHP Development Tools and Libraries
Modern PHP validator on steroids for validating forms and/or array's.
Scan URLs from an array and return an array of inaccessible URLs. An example component from Josh Lockhart's book "Modern PHP" (2015)
Displays an Outdated Browser Banner on your phpBB forum's index page, visible only to Internet Explorer 6/7/8/9 users, to encourage them to upgrade to a modern browser.
Base package for any connector that supports syncing of control groups to tribes
统计信息
- 总下载量: 263
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Unknown
- 更新时间: 2022-04-20