Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

支持调整首页组件的顺序 #1075

Merged
merged 12 commits into from
Feb 10, 2025
Prev Previous commit
Next Next commit
update
leaphy-dev committed Feb 1, 2025
commit 68198a9ee05f531bf856a87927c3a3144fe7719a
18 changes: 12 additions & 6 deletions inc/classes/Customizer.php
Original file line number Diff line number Diff line change
@@ -62,11 +62,17 @@ public function render_content() {
// 首页专用子类
class Homepage_Component_Order_Control extends Generic_Sortable_Control {
protected function get_sortable_items() {
return [
'bulletin' => __('公告栏', 'sakurairo'),
'static_page' => __('静态页面', 'sakurairo'),
'exhibition' => __('展示区域', 'sakurairo'),
'primary' => __('文章列表', 'sakurairo')
];
$component_order = array();
if (iro_opt('bulletin_board') == '1'){
$component_order['bulletin'] = '公告栏';
}
if (iro_opt('exhibition_area') == '1'){
$component_order['exhibition'] = '展示区域';
}
if (get_theme_mod("home_static_page", 0)){
$component_order['static_page'] = '静态页面';
}
$component_order['primary'] = '文章列表';
return $component_order;
}
}
2 changes: 1 addition & 1 deletion inc/customizer.php
Original file line number Diff line number Diff line change
@@ -34,7 +34,7 @@ function set_homepage_controls($wp_customize) {
$wp_customize->remove_control( 'page_for_posts' );
$section = $wp_customize->get_section( 'static_front_page' );
if ( $section ) {
$section->description = '';
$section->description = '部分首页设置项,如果您安装了缓存插件,请在设置后清除缓存。';
}
$wp_customize->add_setting('home_static_page', array(
'default' => 0,