61 lines
3.3 KiB
PHP
61 lines
3.3 KiB
PHP
<?php
|
|
/** Theme functions for Commander 1024 2026. */
|
|
|
|
function c1024_2026_setup() {
|
|
load_theme_textdomain( 'c1024-2026', get_template_directory() . '/languages' );
|
|
add_theme_support( 'automatic-feed-links' );
|
|
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( '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 theme capabilities before WordPress initializes theme-dependent features.
|
|
add_action( 'after_setup_theme', 'c1024_2026_setup' );
|
|
|
|
function c1024_2026_assets() {
|
|
wp_enqueue_style( 'c1024-2026-style', get_stylesheet_uri(), array(), '1.0.0' );
|
|
wp_enqueue_script( 'c1024-2026-theme', get_template_directory_uri() . '/assets/js/theme.js', array(), '1.0.0', true );
|
|
}
|
|
// Load public assets through WordPress so dependencies and plugin integrations remain ordered.
|
|
add_action( 'wp_enqueue_scripts', 'c1024_2026_assets' );
|
|
|
|
function c1024_2026_block_editor_assets() {
|
|
// Load the complete canvas stylesheet inside Gutenberg's editor iframe.
|
|
wp_enqueue_style( 'c1024-2026-editor-style', get_theme_file_uri( '/editor-style.css' ), array(), '1.0.0' );
|
|
}
|
|
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_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_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' ) );
|
|
}
|
|
// Customize controls are registered only while the Customizer API is available.
|
|
add_action( 'customize_register', 'c1024_2026_customize_register' );
|
|
|
|
function c1024_2026_excerpt_more( $more ) {
|
|
return '…';
|
|
}
|
|
// Keep generated excerpts visually concise across all card-based archive loops.
|
|
add_filter( 'excerpt_more', 'c1024_2026_excerpt_more' );
|