Enhance Theme Templates and Editor Layout

This commit is contained in:
2026-07-27 12:34:55 +02:00
parent cbcdbc1bb8
commit 243fb51770
14 changed files with 382 additions and 82 deletions
+60 -17
View File
@@ -7,16 +7,28 @@ function c1024_2026_setup() {
add_theme_support( 'title-tag' );
add_theme_support( 'post-thumbnails' );
add_theme_support( 'responsive-embeds' );
add_theme_support( 'custom-logo', array( 'flex-width' => true, 'flex-height' => true ) );
add_theme_support( 'html5', array( 'search-form', 'comment-form', 'comment-list', 'gallery', 'caption', 'style', 'script' ) );
add_theme_support(
'custom-logo',
array(
'flex-width' => true,
'flex-height' => true,
)
);
add_theme_support(
'html5',
array( 'search-form', 'comment-form', 'comment-list', 'gallery', 'caption', 'style', 'script' )
);
add_theme_support( 'align-wide' );
add_theme_support( 'editor-styles' );
// Classic-editor stylesheet; the same file is explicitly enqueued for the block editor below.
add_editor_style( 'editor-style.css' );
register_nav_menus( array(
'primary' => __( 'Primary menu', 'c1024-2026' ),
'footer' => __( 'Footer menu', 'c1024-2026' ),
) );
register_nav_menus(
array(
'primary' => __( 'Primary menu', 'c1024-2026' ),
'footer' => __( 'Footer menu', 'c1024-2026' ),
)
);
}
// Register theme capabilities before WordPress initializes theme-dependent features.
add_action( 'after_setup_theme', 'c1024_2026_setup' );
@@ -36,19 +48,50 @@ add_action( 'enqueue_block_editor_assets', 'c1024_2026_block_editor_assets' );
// These settings drive the optional front-page hero without hard-coding media or copy.
function c1024_2026_customize_register( $wp_customize ) {
$wp_customize->add_section( 'c1024_2026_home_hero', array(
'title' => __( 'Home page video hero', 'c1024-2026' ),
'description' => __( 'Displayed on the site front page.', 'c1024-2026' ),
'priority' => 30,
) );
$wp_customize->add_section(
'c1024_2026_home_hero',
array(
'title' => __( 'Home page video hero', 'c1024-2026' ),
'description' => __( 'Displayed on the site front page.', 'c1024-2026' ),
'priority' => 30,
)
);
$wp_customize->add_setting( 'c1024_2026_hero_video', array( 'sanitize_callback' => 'absint' ) );
$wp_customize->add_control( new WP_Customize_Media_Control( $wp_customize, 'c1024_2026_hero_video', array(
'label' => __( 'Hero video', 'c1024-2026' ), 'section' => 'c1024_2026_home_hero', 'mime_type' => 'video',
) ) );
$wp_customize->add_setting( 'c1024_2026_hero_title', array( 'default' => get_bloginfo( 'name' ), 'sanitize_callback' => 'sanitize_text_field' ) );
$wp_customize->add_control( 'c1024_2026_hero_title', array( 'label' => __( 'Overlay heading', 'c1024-2026' ), 'section' => 'c1024_2026_home_hero', 'type' => 'text' ) );
$wp_customize->add_control(
new WP_Customize_Media_Control(
$wp_customize,
'c1024_2026_hero_video',
array(
'label' => __( 'Hero video', 'c1024-2026' ),
'section' => 'c1024_2026_home_hero',
'mime_type' => 'video',
)
)
);
$wp_customize->add_setting(
'c1024_2026_hero_title',
array(
'default' => get_bloginfo( 'name' ),
'sanitize_callback' => 'sanitize_text_field',
)
);
$wp_customize->add_control(
'c1024_2026_hero_title',
array(
'label' => __( 'Overlay heading', 'c1024-2026' ),
'section' => 'c1024_2026_home_hero',
'type' => 'text',
)
);
$wp_customize->add_setting( 'c1024_2026_hero_text', array( 'sanitize_callback' => 'sanitize_textarea_field' ) );
$wp_customize->add_control( 'c1024_2026_hero_text', array( 'label' => __( 'Overlay text', 'c1024-2026' ), 'section' => 'c1024_2026_home_hero', 'type' => 'textarea' ) );
$wp_customize->add_control(
'c1024_2026_hero_text',
array(
'label' => __( 'Overlay text', 'c1024-2026' ),
'section' => 'c1024_2026_home_hero',
'type' => 'textarea',
)
);
}
// Customize controls are registered only while the Customizer API is available.
add_action( 'customize_register', 'c1024_2026_customize_register' );