我想安装wordpress主题,但我拥有的版本是5.2.17所以我必须重写代码:
这
// Shortcodes list
//------------------------------------------------------------------
$FIRE_DEPARTMENT_GLOBALS['shortcodes'] = array();
// Add shortcodes
do_action('fire_department_action_shortcodes_list');
// Sort shortcodes list
uasort($FIRE_DEPARTMENT_GLOBALS['shortcodes'], function($a, $b) {
return strcmp($a['title'], $b['title']);
});
到
// Shortcodes list
//------------------------------------------------------------------
$FIRE_DEPARTMENT_GLOBALS['shortcodes'] = array();
// Add shortcodes
do_action('fire_department_action_shortcodes_list');
$tmp = fire_department_storage_get('shortcodes');
function strcmp_fun(){
strcmp($a['title'], $b['title']);
}
uasort($tmp, 'strcmp_fun');
fire_department_storage_set('shortcodes', $tmp);
但我在wordpress中有PHP警告'的debug.log:
PHP警告:uasort():参数应该是/(..)/public_html/osp/wp-content/themes/fire-department/fw/core/core.shortcodes/shortcodes_settings.php上的一个数组173
上面的代码有什么问题?
答案 0 :(得分:0)
没关系?错误消失了
//$tmp = fire_department_storage_get('shortcodes');
function strcmp_fun($a, $b){
return strcmp($a['title'], $b['title']);
}
uasort($FIRE_DEPARTMENT_GLOBALS['shortcodes'], 'strcmp_fun');
//fire_department_storage_set('shortcodes', $tmp);