wpup/features

WordPress设置页面,用于功能标志接口/实现

安装次数: 9

依赖项: 0

建议者: 0

安全性: 0

星标: 1

关注者: 3

分支: 0

开放问题: 0

类型:wordpress-plugin

v1.0.1 2018-04-25 06:39 UTC

This package is auto-updated.

Last update: 2024-08-29 04:42:15 UTC


README

Build Status No Maintenance Intended

WordPress设置页面用于php-features。该插件安装时将安装此包,因此无需自行安装。

安装

composer require wpup/features

用法

首先阅读php-features的README文件,了解该包的工作原理。

示例

features( [
    'log'      => false,
    'checkout' => true
] );

最佳实践是在WordPress加载前设置功能,例如配置文件。

过滤器

向功能设置页面添加自定义描述

add_filter( 'features_description', function () {
    return 'my custom description';
} );

描述已转义,不允许HTML。

在管理员界面添加自定义标签而不是功能键

add_filter( 'features_labels', function () {
    return [
        'log' => 'Log'
    ];
} );

更改管理员菜单能力

add_filter( 'features_capability', function () {
    return 'custom-cap';
} );

许可证

MIT © Fredrik Forsmo