fix(frontend): match the reference post format options in the page set modal
参考主题把文章格式固定为标准/图像/画廊/视频四项,动态读取
get_theme_support('post-formats') 会让本站多出 aside/quote/link
等注册格式,选项集偏离参考主题,故改为固定列表。
This commit is contained in:
@@ -412,13 +412,21 @@ class PageAdminSet {
|
||||
return $this->render_inputs($inputs);
|
||||
}
|
||||
|
||||
/** AKSRT 注册的文章格式(standard + add_theme_support 注册项)。 */
|
||||
/**
|
||||
* 文章格式选项(1:1 对齐参考主题的固定列表)。
|
||||
*
|
||||
* 参考主题把标准/图像/画廊/视频四个格式写死在弹窗里,不读
|
||||
* get_theme_support('post-formats')。本站注册的格式比参考主题多
|
||||
* (aside/quote/link 等),动态枚举会让选项集偏离参考主题,
|
||||
* 因此同样固定这四项。
|
||||
*/
|
||||
private function post_format_options(): array {
|
||||
$options = ['standard' => __('标准', 'aksrt')];
|
||||
foreach (get_theme_support('post-formats') ? (array) get_theme_support('post-formats')[0] : [] as $format) {
|
||||
$options[$format] = esc_html(get_post_format_string($format));
|
||||
}
|
||||
return $options;
|
||||
return [
|
||||
'standard' => __('标准', 'aksrt'),
|
||||
'image' => __('图像', 'aksrt'),
|
||||
'gallery' => __('画廊', 'aksrt'),
|
||||
'video' => __('视频', 'aksrt'),
|
||||
];
|
||||
}
|
||||
|
||||
/** 分类术语的弹窗字段(对齐参考主题 tax 分支)。 */
|
||||
|
||||
Reference in New Issue
Block a user