本文整理匯總了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);
}
}