

/**
* 添加块分类 显示在第一位
*/
add_filter( 'block_categories', 'dahuzi_blocks_add_custom_block_category', 99, 1);
function dahuzi_blocks_add_custom_block_category($categories)
{
//自定义分类数组
$temp = array(
'slug' => 'dahuzi-blocks',
'title' => 'XinTheme|Blocks'
);
//新分类数组 在第一个位置添加新的自定义块分类
$newCategories = array();
$newCategories[0] = $temp;
//在数组中追加原始分类
foreach ($categories as $category) {
$newCategories[] = $category;
}
//返回新分类
return $newCategories;
}
© 版权声明
THE END
暂无评论内容