Replace all yarn references with npm across README, CLAUDE.md, CHANGELOG, .gitignore, and CI workflow. Remove yarn.lock. Co-Authored-By: Claude <noreply@anthropic.com>
9.1 KiB
WordPress Theme using Bootstrap 5
Author: Marco Graetsch Author URL: https://src.bundespruefstelle.ch/magdev Author Email: magdev3.0@gmail.com Repository URL: https://src.bundespruefstelle.ch/magdev/wp-bootstrap Issues URL: https://src.bundespruefstelle.ch/magdev/wp-bootstrap/issues
Project Overview
This WordPress-Theme is built from scratch employing Bootstrap 5. Build modern Websites using the state-of-the-art Framework. All basic WordPress components are converted and are fully working. The theme uses Twig for rendering. It is also a good starting point as base theme for complex WordPress websites.
Features
- All native WordPress theme files converted to Boostrap 5
- Works seemlessly on default WordPress installations
- Installable via WordPress admin
Frontend
- Fully responsive Design
- Supports darkmode
Administration
- Compatible with the Gutenberg-Editor
- Customizable with the Design-Editor
Key Fact: 100% AI-Generated
This project is proudly "vibe-coded" using Claude.AI - the entire codebase was created through AI assistance.
Temporary Roadmap
Note for AI Assistants: Clean this section after the specific features are done or new releases are made. Effective changes are tracked in CHANGELOG.md. Do not add completed versions here - document them in the Session History section at the end of this file.
Next milestone is v0.2.0 - Design Editor. See PLAN.md for details.
Technical Stack
- Language: PHP 8.3.x
- PHP-Standards: PSR-4
- Framework: Latest WordPress Theme API
- Template Engine: Twig 3.0 (via Composer)
- Frontend: Bootstrap 5 Javascript & Vanilla JavaScript
- Styling: Bootstrap 5 & Custom CSS (if necessary)
- Dependency Management: Composer (PHP), npm (JS/CSS)
- Internationalization: WordPress i18n (.pot/.po/.mo files)
- Canonical Plugin Name:
wp-bootstrap
Security Best Practices
- All user inputs are sanitized (integers for quantities/prices)
- Nonce verification on form submissions
- Output escaping in templates (
esc_attr,esc_html,esc_js) - Direct file access prevention via
ABSPATHcheck - XSS-safe DOM construction in JavaScript (no
innerHTMLwith user data)
Translation Ready
All user-facing strings use:
__('Text to translate', 'wp-bootstrap')
_e('Text to translate', 'wp-bootstrap')
Text domain: wp-bootstrap
Translation Template
- Base
.potfile created:languages/wp-bootstrap.pot - Ready for translation to any locale
- All translatable strings properly marked with text domain
Available Translations
en_US- English (United States) [base language - .pot template]de_CH- German (Switzerland, formal)
There is no need to compile translation to *.mo locally as it will be done in the Gitea CD/CI pipeline
Create Releases
Important Git Notes:
- Default branch while development is
dev - Create releases from branch
mainafter merging branchdev - Tags should use format
vX.X.X(e.g.,v1.1.22), start with v0.1.0 - Use annotated tags (
-a) not lightweight tags - ALWAYS push tags to origin - CI/CD triggers on tag push
- Commit messages should follow the established format with Claude Code attribution
.claude/settings.local.jsonchanges are typically local-only (stash before rebasing)
CRITICAL - Release Workflow:
On every new version, ALWAYS execute this complete workflow:
# 1. Commit changes to dev branch
git add <files>
git commit -m "Description of changes (vX.X.X)"
# 2. Merge dev to main
git checkout main
git merge dev --no-edit
# 3. Create annotated tag
git tag -a vX.X.X -m "Version X.X.X - Brief description"
# 4. Push everything to origin
git push origin dev main vX.X.X
# 5. Switch back to dev for continued development
git checkout dev
Never skip any of these steps. The release is not complete until all branches and the tag are pushed to origin.
For AI Assistants:
When starting a new session on this project:
- Read this CLAUDE.md file first
- Semantic versioning follows the
MAJOR.MINOR.BUGFIXpattern - Check git log for recent changes
- Verify you're on the
devbranch before making changes - Run
git submodule update --init --recursiveif lib/ is empty (only if submodules present) - Run
composer installif vendor/ is missing - Test changes before committing
- Follow commit message format with Claude Code attribution
- Update this session history section with learnings
- Never commit backup files (
*.po~,*.bak, etc.) - checkgit statusbefore committing - Follow markdown linting rules (see below)
Always refer to this document when starting work on this project.
Markdown Linting Rules
When editing CLAUDE.md or other markdown files, follow these rules to avoid linting errors:
-
MD031 - Blank lines around fenced code blocks: Always add a blank line before and after fenced code blocks, even when they follow list items. Example of correct format:
-
Item label:
(blank line here) ```php code example ``` (blank line here)
-
-
MD056 - Table column count: Table separators must have matching column counts and proper spacing. Use consistent dash lengths that match column header widths.
-
MD009 - No trailing spaces: Remove trailing whitespace from lines
-
MD012 - No multiple consecutive blank lines: Use only single blank lines between sections
-
MD040 - Fenced code blocks should have a language specified: Always add a language identifier to code blocks (e.g.,
txt,bash,php). For shortcode examples, usetxt. -
MD032 - Lists should be surrounded by blank lines: Add a blank line before AND after list blocks, including after bold labels like
**Attributes:**. -
MD034 - Bare URLs: Wrap URLs in angle brackets (e.g.,
<https://example.com>) or use markdown link syntax[text](url). -
Author section formatting: Use a heading (
### Name) instead of bold (**Name**) for the author name to maintain consistent document structure.
Build Pipeline
The build uses npm scripts defined in package.json:
# Full build (CI and local)
npm run build
# Development watch mode
npm run dev
Build steps (in order):
copy:js— Copy Bootstrap JS bundle fromnode_modulestoassets/js/copy:theme-js— Copy theme JS (e.g.,dark-mode.js) fromsrc/js/toassets/js/scss— Compile SCSS (src/scss/) to CSS (assets/css/)postcss— Autoprefixer + cssnano minification →assets/css/style.min.css
CI/CD note: The Gitea workflow uses npm install and npm run build.
Architecture Notes
- Dark mode: Uses Bootstrap 5.3
data-bs-themeattribute on<html>. An inline anti-flash script runs synchronously in<head>(viawp_add_inline_scriptwith'before'), while the fulldark-mode.jsis deferred. Preference stored inlocalStoragekeywp-bootstrap-theme. - Block styles: Registered via
register_block_style()withinline_styleparameter infunctions.php. Dark mode overrides for alert/card styles are insrc/scss/_custom.scss. - Style variations: JSON files in
styles/directory. All 4 variations use the same 10 color slug names (base, contrast, primary, secondary, success, danger, warning, info, light, dark) to ensure patterns work across all schemes. - Fonts: Inter (sans-serif) and Lora (serif) variable fonts bundled as
.woff2inassets/fonts/. Declared viafontFaceintheme.jsonwithfont-display: swap. - Patterns: PHP files in
patterns/with WordPress block markup and i18n. Hidden patterns (prefixedhidden-) are reusable components not shown in the pattern inserter.
Session History
Session 2 — v0.1.0 Core Theme (2026-02-08)
Completed: Full v0.1.0 milestone implementation.
What was built:
- 16 block patterns across 7 new categories (hero, features, CTA, testimonials, pricing, contact, text)
- Dark mode toggle with SVG sun/moon icons, localStorage persistence,
prefers-color-schemedetection - 17 custom block styles mapping Bootstrap components to WordPress blocks
- 4 style variations: Ocean, Forest, Sunset, Midnight
- Sidebar template part + "Blog with Sidebar" custom template
- Inter + Lora variable web fonts with Display font size
Key learnings:
- CI uses
npm install/npm run build—yarnis not available in the CI runner - Bootstrap 5 alert colors are hardcoded (not CSS variables), so explicit dark mode overrides are needed in SCSS
- Anti-flash for dark mode requires a synchronous inline script via
wp_add_inline_script('handle', '...', 'before')— the deferred JS alone causes a flash - Variable fonts use
fontWeight: "100 900"range syntax intheme.jsonfontFacedeclarations - Style variation JSON files must maintain identical color slug names across all variations for patterns to work correctly
- When re-tagging a release, delete the remote tag first (
git push origin :refs/tags/vX.X.X) then recreate and push
Session 1 — v0.0.1 Getting Started (2026-02-08)
Completed: Initial theme scaffolding, Bootstrap 5 integration, SASS pipeline, Twig setup, CI/CD workflow, basic FSE templates and patterns, i18n support.