lucatume/wp-wrappers

此包已废弃,不再维护。未建议替代包。

WordPress 包装器,用于简化主题和插件的开发。

2.0.5 2014-09-18 14:04 UTC

This package is not auto-updated.

Last update: 2016-12-08 10:30:45 UTC


README

一组封装 WordPress 常用操作的类。

选项

此类允许创建、读取和更新存储在数据库中的选项。它是 update_optionload_option 方法的封装。
它将创建和读取数组选项,键将以 camelBack 格式提供。

// get the 'my_theme' option from the database
$the = tad_OptionWrapper::on('my_theme');

// if the option defines 'header_text', 'footer_color' and 'sidebar_position'
$headerText = $the->headerText;
$footerColor = $the->footerColor;
$sidebarPosition = $the->sidebarPosition;

序列化的 tad_OptionWrapper

与 tad_OptionWrapper 类类似,但目前没有写入支持。实际上,向其中提供非序列化选项不会成问题。

主题支持

允许在 WordPress 中快速添加和删除主题支持。

// add HTML5 search form support
tad_ThemeSupport::addSupport('html5', 'search-form');

// remove the support
tad_ThemeSupport::removeSupport('html5', 'search-form');