You've already forked wp-bootstrap
Initial theme scaffolding (v0.0.1)
- Bootstrap 5 CSS/JS integration via Yarn (served locally) - Dart Sass build pipeline with PostCSS, Autoprefixer, cssnano - Twig 3.0 via Composer with PSR-4 autoloading - FSE block theme templates (index, home, single, page, archive, search, 404) - Template parts (header, footer) and block patterns - theme.json with Bootstrap 5-aligned design tokens - Gitea CI/CD workflow for automated release packages - WordPress i18n support (en_US base, de_CH translation) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
95
functions.php
Normal file
95
functions.php
Normal file
@@ -0,0 +1,95 @@
|
||||
<?php
|
||||
/**
|
||||
* WP Bootstrap functions and definitions.
|
||||
*
|
||||
* @link https://developer.wordpress.org/themes/basics/theme-functions/
|
||||
*
|
||||
* @package WPBootstrap
|
||||
* @since 0.0.1
|
||||
*/
|
||||
|
||||
// Prevent direct access.
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
// Load Composer autoloader.
|
||||
if ( file_exists( get_template_directory() . '/vendor/autoload.php' ) ) {
|
||||
require_once get_template_directory() . '/vendor/autoload.php';
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets up theme defaults and registers support for various WordPress features.
|
||||
*/
|
||||
if ( ! function_exists( 'wp_bootstrap_setup' ) ) :
|
||||
function wp_bootstrap_setup() {
|
||||
// Add support for post formats.
|
||||
add_theme_support( 'post-formats', array(
|
||||
'aside', 'audio', 'chat', 'gallery', 'image',
|
||||
'link', 'quote', 'status', 'video',
|
||||
) );
|
||||
|
||||
// Make theme available for translation.
|
||||
load_theme_textdomain( 'wp-bootstrap', get_template_directory() . '/languages' );
|
||||
|
||||
// Add editor styles.
|
||||
add_editor_style( 'assets/css/editor-style.css' );
|
||||
}
|
||||
endif;
|
||||
add_action( 'after_setup_theme', 'wp_bootstrap_setup' );
|
||||
|
||||
/**
|
||||
* Enqueue theme scripts and styles.
|
||||
*/
|
||||
if ( ! function_exists( 'wp_bootstrap_enqueue_scripts' ) ) :
|
||||
function wp_bootstrap_enqueue_scripts() {
|
||||
$theme_version = wp_get_theme()->get( 'Version' );
|
||||
$suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
|
||||
|
||||
// Enqueue the compiled Bootstrap + custom CSS.
|
||||
wp_enqueue_style(
|
||||
'wp-bootstrap-style',
|
||||
get_template_directory_uri() . '/assets/css/style' . $suffix . '.css',
|
||||
array(),
|
||||
$theme_version
|
||||
);
|
||||
|
||||
// Enqueue Bootstrap JS bundle (includes Popper).
|
||||
wp_enqueue_script(
|
||||
'wp-bootstrap-js',
|
||||
get_template_directory_uri() . '/assets/js/bootstrap.bundle.min.js',
|
||||
array(),
|
||||
$theme_version,
|
||||
true
|
||||
);
|
||||
}
|
||||
endif;
|
||||
add_action( 'wp_enqueue_scripts', 'wp_bootstrap_enqueue_scripts' );
|
||||
|
||||
/**
|
||||
* Register block pattern categories.
|
||||
*/
|
||||
if ( ! function_exists( 'wp_bootstrap_pattern_categories' ) ) :
|
||||
function wp_bootstrap_pattern_categories() {
|
||||
register_block_pattern_category(
|
||||
'wp-bootstrap_page',
|
||||
array(
|
||||
'label' => __( 'Pages', 'wp-bootstrap' ),
|
||||
'description' => __( 'A collection of full page layouts.', 'wp-bootstrap' ),
|
||||
)
|
||||
);
|
||||
}
|
||||
endif;
|
||||
add_action( 'init', 'wp_bootstrap_pattern_categories' );
|
||||
|
||||
/**
|
||||
* Initialize Twig template engine.
|
||||
*/
|
||||
if ( ! function_exists( 'wp_bootstrap_init_twig' ) ) :
|
||||
function wp_bootstrap_init_twig() {
|
||||
if ( class_exists( '\\WPBootstrap\\Twig\\TwigService' ) ) {
|
||||
\WPBootstrap\Twig\TwigService::getInstance();
|
||||
}
|
||||
}
|
||||
endif;
|
||||
add_action( 'after_setup_theme', 'wp_bootstrap_init_twig' );
|
||||
Reference in New Issue
Block a user