elcontraption / wp-theme-config
为WordPress主题设置提供明智的默认设置和智能覆盖。
0.2.20
2018-04-06 12:56 UTC
Requires
- php: >=5.4.0
Requires (Dev)
- phpunit/phpunit: ~4.5
README
为WordPress主题设置提供明智的默认设置和智能覆盖。
安装
通过Composer
composer require elcontraption/wp-theme-config
设置
在你的主题的 functions.php
文件中
/** * Require Composer's autoloader if you haven't already: */ require('vendor/autoload.php'); /** * Initialize ThemeConfig. */ ElContraption\WpThemeConfig\ThemeConfig::getInstance();
查看默认配置文件。你可以在主题的 config
目录中创建同名文件来覆盖默认配置文件中的任何设置。你的配置覆盖必须返回一个数组。你只需要声明你想要覆盖的设置。
添加配置设置
TODO: 添加文档说明。
重要:所有配置设置都在 after_setup_theme
钩子上初始化,因此需要在那个钩子上初始化的操作不应该用 add_action
包装。