underpin / sidebar-loader
Underpin 的边栏加载器
1.1.0
2021-11-24 21:42 UTC
Requires
- underpin/underpin: ^2.0
This package is auto-updated.
Last update: 2024-08-25 03:52:17 UTC
README
这是一个帮助在 WordPress 网站中添加侧边栏(小工具区域)的加载器。
安装
使用 Composer
composer require underpin/sidebar-loader
手动
此插件使用内置的自动加载器,因此只要它在 Underpin 之前被要求,就应该按预期工作。
require_once(__DIR__ . '/underpin-sidebars/sidebars.php');
设置
- 安装 Underpin。请参阅 Underpin 文档
- 根据需要注册新的边栏菜单。
示例
一个非常基础的例子可能看起来像这样。
// Register sidebar underpin()->sidebars()->add( 'example-sidebar', [ 'name' => underpin()->__( 'Human readable name' ), 'id' => 'example', 'description' => underpin()->__( 'Human readable description' ), ] );
或者,您可以通过扩展 Sidebar
并直接引用扩展类来实现
underpin()->sidebars()->add('sidebar-key','Namespace\To\Class');