本文整理汇总了PHP中Kirki::field方法的典型用法代码示例。如果您正苦于以下问题:PHP Kirki::field方法的具体用法?PHP Kirki::field怎么用?PHP Kirki::field使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Kirki
的用法示例。
在下文中一共展示了Kirki::field方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: kirki_update
/**
* Takes care of all the migration and compatibility issues with previous versions.
*/
function kirki_update()
{
$version = get_option('kirki_version');
$version = !$version ? '0' : $version;
// < 0.6.1 -> 0.6.2
if (!$version) {
/**
* In versions 0.6.0 & 0.6.1 there was a bug and some fields were saved as ID_opacity istead if ID
* This will fix the wrong settings naming and save new settings.
*/
$field_ids = array();
$fields = Kirki::fields()->get_all();
foreach ($fields as $field) {
$field = Kirki::field()->sanitize($field);
if ('background' != $field['type']) {
$field_ids[] = $field['settings'];
}
}
foreach ($field_ids as $field_id) {
if (get_theme_mod($field_id . '_opacity') && !get_theme_mod($field_id)) {
set_theme_mod($field_id, get_theme_mod($field_id . '_opacity'));
}
}
}
if (!$version || version_compare(Kirki::$version, $version)) {
update_option('kirki_version', Kirki::$version);
}
}