init
This commit is contained in:
63
theme/inc/setup.php
Normal file
63
theme/inc/setup.php
Normal file
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
/**
|
||||
* Theme Setup — registers supports, menus, patterns, and editor styles.
|
||||
*
|
||||
* @package OTS_Theme
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
/* ── Theme supports ────────────────────────────────────────── */
|
||||
add_action( 'after_setup_theme', function () {
|
||||
|
||||
// FSE / block essentials
|
||||
add_theme_support( 'wp-block-styles' );
|
||||
add_theme_support( 'responsive-embeds' );
|
||||
add_theme_support( 'editor-styles' );
|
||||
|
||||
// Classic fallback supports (still respected by block themes)
|
||||
add_theme_support( 'automatic-feed-links' );
|
||||
add_theme_support( 'title-tag' );
|
||||
add_theme_support( 'post-thumbnails' );
|
||||
add_theme_support( 'custom-logo', [
|
||||
'height' => 40,
|
||||
'width' => 180,
|
||||
'flex-height' => true,
|
||||
'flex-width' => true,
|
||||
] );
|
||||
add_theme_support( 'html5', [
|
||||
'search-form',
|
||||
'comment-form',
|
||||
'comment-list',
|
||||
'gallery',
|
||||
'caption',
|
||||
'style',
|
||||
'script',
|
||||
] );
|
||||
|
||||
// Load main.css inside the block editor so previews match the frontend
|
||||
add_editor_style( 'assets/css/main.css' );
|
||||
|
||||
// Navigation menus (used by oribi/site-header block)
|
||||
register_nav_menus( [
|
||||
'primary' => __( 'Primary Menu', 'ots-theme' ),
|
||||
'footer' => __( 'Footer Menu', 'ots-theme' ),
|
||||
] );
|
||||
} );
|
||||
|
||||
/* ── Block pattern categories ──────────────────────────────── */
|
||||
add_action( 'init', function () {
|
||||
register_block_pattern_category( 'oribi-pages', [
|
||||
'label' => __( 'Oribi Tech — Pages', 'ots-theme' ),
|
||||
] );
|
||||
register_block_pattern_category( 'oribi-sections', [
|
||||
'label' => __( 'Oribi Tech — Sections', 'ots-theme' ),
|
||||
] );
|
||||
} );
|
||||
|
||||
/* ── Remove core block patterns if desired ─────────────────── */
|
||||
add_action( 'after_setup_theme', function () {
|
||||
remove_theme_support( 'core-block-patterns' );
|
||||
} );
|
||||
Reference in New Issue
Block a user