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>
2026-02-08 02:25:33 +01:00
# WP Bootstrap
2026-02-08 15:11:00 +01:00
A modern WordPress Block Theme built from scratch with Bootstrap 5. Features responsive design, dark mode support, Twig template rendering, and full compatibility with the WordPress Site Editor.
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>
2026-02-08 02:25:33 +01:00
## Features
2026-02-08 15:11:00 +01:00
- **Bootstrap 5 Frontend** -- Proper Bootstrap 5 HTML (navbar, cards, pagination, grid) rendered via Twig templates
- **Dark Mode** -- Toggle with localStorage persistence and `prefers-color-scheme` support
- **Full Site Editing** -- Compatible with the WordPress Site Editor for admin editing
2026-02-08 18:43:09 +01:00
- **Style Variations** -- 15 color schemes (7 light, 7 dark, plus default) with live Design Editor customization
- **Block Patterns** -- 41 patterns across 11 categories (hero, features, CTA, testimonials, pricing, contact, text, layout, components, navigation, pages)
2026-02-09 09:28:26 +01:00
- **Bootstrap Icons** -- 2,000+ icons available via CSS classes (`bi bi-*` )
feat: Bootstrap 5 block renderer, widget cards, and sidebar post layout (v1.1.0)
Add BlockRenderer class injecting Bootstrap classes into 8 core block types
(table, button, buttons, image, search, quote, pullquote, list) via per-block
render_block filters using WP_HTML_Tag_Processor.
Add WidgetRenderer class wrapping sidebar widgets in Bootstrap card components
with h4 heading hierarchy via dynamic_sidebar_params and widget_block_content
filters.
Add widget SCSS stylesheet for list styling, search input-group, tag cloud
pills, and card-flush list positioning.
Add single-sidebar.html.twig as the default post template with two-column
Bootstrap layout (col-lg-8 content, col-lg-4 sidebar). Full-width available
via template selection.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-28 23:43:43 +01:00
- **Block Renderer** -- Automatic Bootstrap 5 class injection on 8 core block types (table, button, image, search, quote, pullquote, list) via `render_block` filters
- **Widget Renderer** -- Sidebar widgets wrapped in Bootstrap cards with proper heading hierarchy
- **Block Styles** -- 18 custom styles mapping Bootstrap components to WordPress blocks (including List Group)
- **Custom Templates** -- Landing (no header/footer), full-width, hero, sidebar page templates; blog posts default to sidebar layout
2026-02-08 18:43:09 +01:00
- **Header/Footer Variations** -- Default, centered, transparent headers; default, minimal, multi-column footers
2026-02-08 16:05:29 +01:00
- **Navigation Styles** -- Dark navbar, offcanvas mobile navigation
2026-02-08 18:43:09 +01:00
- **Widget Area** -- Sidebar widget area manageable via WordPress admin, with built-in fallback
- **Accessibility** -- Skip-to-content link, ARIA labels, `aria-current` on active items, screen reader announcements
- **RTL Support** -- Right-to-left language support with logical CSS properties
fix: standardize translation file names and add 11 new locales (v1.0.5)
- Rename all .po files to use wp-bootstrap- prefix (WordPress convention)
- Add 11 new locale translations (de_CH_informal, de_DE, de_DE_informal,
en_GB, es_ES, fr_CH, it_CH, it_IT, nl_NL, pl_PL, pt_PT)
- Total: 13 locales + en_US base = 14 supported languages
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-11 17:51:18 +01:00
- **Translation Ready** -- Full i18n support with 14 locales (en_US, de_CH, de_CH_informal, de_DE, de_DE_informal, en_GB, es_ES, fr_CH, fr_FR, it_CH, it_IT, nl_NL, pl_PL, pt_PT)
2026-02-08 15:11:00 +01:00
- **Responsive** -- Mobile-first design with Bootstrap's responsive grid
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>
2026-02-08 02:25:33 +01:00
## Requirements
- WordPress 6.7 or higher
- PHP 8.3 or higher
2026-02-08 15:11:00 +01:00
- Composer
- Node.js 20+
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>
2026-02-08 02:25:33 +01:00
## Installation
### From Release Package
1. Download the latest `.zip` from [Releases ](https://src.bundespruefstelle.ch/magdev/wp-bootstrap/releases )
2. Go to WordPress Admin > Appearance > Themes > Add New > Upload Theme
3. Upload the ZIP file and activate
### From Source
```bash
git clone ssh://git@src .bundespruefstelle.ch:2022/magdev/wp-bootstrap.git
cd wp-bootstrap
composer install
2026-02-08 03:20:25 +01:00
npm install
npm run build
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>
2026-02-08 02:25:33 +01:00
```
2026-02-08 15:11:00 +01:00
Activate the theme in **Appearance > Themes ** in the WordPress admin.
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>
2026-02-08 02:25:33 +01:00
## Development
### Prerequisites
- Node.js 20+
2026-02-08 03:20:25 +01:00
- npm
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>
2026-02-08 02:25:33 +01:00
- Composer
- PHP 8.3+
### Build Commands
| Command | Description |
| --- | --- |
2026-02-08 15:11:00 +01:00
| `npm run build` | Full production build (copy JS, compile SCSS, minify CSS) |
2026-02-08 03:20:25 +01:00
| `npm run dev` | Watch SCSS files and recompile on changes |
| `npm run scss` | Compile SCSS only |
2026-02-08 15:11:00 +01:00
| `npm run postcss` | Minify CSS with Autoprefixer and cssnano |
| `composer install` | Install PHP dependencies (Twig) |
### Build Pipeline
1. `copy:js` -- Copy Bootstrap JS bundle from `node_modules` to `assets/js/`
2. `copy:theme-js` -- Copy theme JS (dark-mode.js) from `src/js/` to `assets/js/`
2026-02-09 09:28:26 +01:00
3. `copy:icons` -- Copy Bootstrap Icons font files (`.woff` , `.woff2` ) to `assets/fonts/`
4. `scss` -- Compile SCSS (`src/scss/` ) to CSS (`assets/css/` )
5. `scss:rtl` -- Compile RTL stylesheet (`assets/css/rtl.css` )
6. `postcss` -- Autoprefixer + cssnano minification to `assets/css/style.min.css`
2026-02-08 15:11:00 +01:00
## Architecture
### Frontend Rendering
The theme uses a dual-rendering approach:
- **Site Editor (admin):** FSE block templates in `templates/` and `parts/` for visual editing
- **Frontend (public):** Twig templates in `views/` render Bootstrap 5 HTML via the `template_redirect` hook
2026-02-11 11:48:08 +01:00
The `TemplateController` intercepts frontend requests and renders the appropriate Twig template with data gathered by `ContextBuilder` . Plugins can hook into the `wp_bootstrap_should_render_template` filter to prevent rendering for specific requests (e.g., when a plugin handles its own custom post types). FSE templates remain untouched for the WordPress admin editor.
2026-02-08 15:11:00 +01:00
2026-02-08 18:43:09 +01:00
### Style Variation Bridge
WordPress style variation colors are bridged to Bootstrap CSS custom properties at runtime. When a variation is selected in the Design Editor, the theme reads the active palette via `wp_get_global_settings()` and outputs inline CSS that overrides Bootstrap's compiled defaults. This works for both light and dark mode.
2026-02-08 15:11:00 +01:00
### Key PHP Classes
| Class | Purpose |
| --- | --- |
| `TwigService` | Singleton Twig environment with WordPress functions and globals |
| `TemplateController` | Hooks `template_redirect` , resolves and renders Twig templates |
| `ContextBuilder` | Gathers WordPress data (posts, menus, pagination, comments, sidebar) |
| `NavWalker` | Converts flat menu items to nested tree for Bootstrap dropdowns |
feat: Bootstrap 5 block renderer, widget cards, and sidebar post layout (v1.1.0)
Add BlockRenderer class injecting Bootstrap classes into 8 core block types
(table, button, buttons, image, search, quote, pullquote, list) via per-block
render_block filters using WP_HTML_Tag_Processor.
Add WidgetRenderer class wrapping sidebar widgets in Bootstrap card components
with h4 heading hierarchy via dynamic_sidebar_params and widget_block_content
filters.
Add widget SCSS stylesheet for list styling, search input-group, tag cloud
pills, and card-flush list positioning.
Add single-sidebar.html.twig as the default post template with two-column
Bootstrap layout (col-lg-8 content, col-lg-4 sidebar). Full-width available
via template selection.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-28 23:43:43 +01:00
| `BlockRenderer` | Injects Bootstrap 5 classes into core block HTML via `render_block` filters |
| `WidgetRenderer` | Wraps sidebar widgets in Bootstrap card components |
2026-02-08 15:11:00 +01:00
### Navigation Menus
Register menus in **Appearance > Menus ** :
- **Primary Navigation** -- Displayed in the Bootstrap navbar with dropdown support
- **Footer Navigation** -- Displayed in the footer
If no menu is assigned, the primary location falls back to listing published pages.
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>
2026-02-08 02:25:33 +01:00
2026-02-08 18:43:09 +01:00
### Widget Areas
feat: Bootstrap 5 block renderer, widget cards, and sidebar post layout (v1.1.0)
Add BlockRenderer class injecting Bootstrap classes into 8 core block types
(table, button, buttons, image, search, quote, pullquote, list) via per-block
render_block filters using WP_HTML_Tag_Processor.
Add WidgetRenderer class wrapping sidebar widgets in Bootstrap card components
with h4 heading hierarchy via dynamic_sidebar_params and widget_block_content
filters.
Add widget SCSS stylesheet for list styling, search input-group, tag cloud
pills, and card-flush list positioning.
Add single-sidebar.html.twig as the default post template with two-column
Bootstrap layout (col-lg-8 content, col-lg-4 sidebar). Full-width available
via template selection.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-28 23:43:43 +01:00
The theme registers a **Sidebar ** widget area. When widgets are assigned via **Appearance > Widgets ** , they replace the default sidebar content. When no widgets are assigned, the sidebar displays recent posts, a search form, and a tag cloud. All sidebar widgets are automatically wrapped in Bootstrap card components with consistent heading styles.
### Block Renderer
The `BlockRenderer` class hooks per-block `render_block_{$name}` filters (more performant than a single `render_block` filter) and uses WordPress's `WP_HTML_Tag_Processor` for safe, idempotent class injection. Only active on the frontend — admin, REST API, and AJAX requests are skipped. Child themes can modify the block-to-handler map via the `wp_bootstrap_block_renderer_blocks` filter.
### Widget Renderer
The `WidgetRenderer` class transforms sidebar widget output into Bootstrap card components. It hooks `dynamic_sidebar_params` for wrapper HTML and `widget_block_content` for inner content adjustments (heading level downgrade from `<h2>` to `<h4>` ). The card structure uses `card-body` with `card-title` inside, ensuring valid HTML whether or not a widget outputs a title.
2026-02-08 18:43:09 +01:00
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>
2026-02-08 02:25:33 +01:00
### Project Structure
```txt
wp-bootstrap/
2026-02-08 15:11:00 +01:00
+-- assets/ Compiled CSS, JS, fonts
+-- inc/
feat: Bootstrap 5 block renderer, widget cards, and sidebar post layout (v1.1.0)
Add BlockRenderer class injecting Bootstrap classes into 8 core block types
(table, button, buttons, image, search, quote, pullquote, list) via per-block
render_block filters using WP_HTML_Tag_Processor.
Add WidgetRenderer class wrapping sidebar widgets in Bootstrap card components
with h4 heading hierarchy via dynamic_sidebar_params and widget_block_content
filters.
Add widget SCSS stylesheet for list styling, search input-group, tag cloud
pills, and card-flush list positioning.
Add single-sidebar.html.twig as the default post template with two-column
Bootstrap layout (col-lg-8 content, col-lg-4 sidebar). Full-width available
via template selection.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-28 23:43:43 +01:00
| +-- Block/ BlockRenderer, WidgetRenderer
2026-02-08 15:11:00 +01:00
| +-- Template/ TemplateController, ContextBuilder, NavWalker
| +-- Twig/ TwigService singleton
+-- languages/ Translation files (.pot, .po)
+-- patterns/ Block patterns (PHP)
2026-02-08 16:05:29 +01:00
+-- parts/ FSE template parts (header, footer, sidebar, variants)
2026-02-08 15:11:00 +01:00
+-- src/
| +-- js/ Source JavaScript
| +-- scss/ Source SCSS
+-- styles/ Style variations (JSON)
+-- templates/ FSE templates (HTML)
+-- views/ Twig templates (Bootstrap 5 HTML)
| +-- base.html.twig
| +-- pages/ Page templates (index, single, page, archive, search, 404)
| +-- partials/ Reusable parts (header, footer, pagination, sidebar, etc.)
| +-- components/ UI components (post card, post loop)
+-- functions.php Theme bootstrap
+-- style.css Theme metadata
+-- theme.json Design tokens and settings
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>
2026-02-08 02:25:33 +01:00
```
2026-02-08 15:11:00 +01:00
## Technology Stack
- **PHP 8.3+** with PSR-4 autoloading
- **Twig 3.0** via Composer
- **Bootstrap 5.3+** CSS & JS (served locally)
- **Dart Sass** for SCSS compilation
- **PostCSS** with Autoprefixer and cssnano
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>
2026-02-08 02:25:33 +01:00
## License
2026-02-08 15:11:00 +01:00
GPL-2.0-or-later. See <http://www.gnu.org/licenses/gpl-2.0.html>.
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>
2026-02-08 02:25:33 +01:00
## Author
2026-02-08 15:11:00 +01:00
Marco Graetsch - <https://src.bundespruefstelle.ch/magdev>