This is a WordPress base project with Bedrock, Timber and Vite.
I gathered a lot of good practises over my years of freelance developer, and combined theme as a full starter pack for any WordPress project, for any developer bored by the lack of modernism in the WordPress coding styles.
It IS opinionated since it was mainly built for my personal use, but I wanted to share it thinking it could help some people.
- PHP 8.0+
- Composer
- node 20.19+ (or 22.12+)
git clone git@github.com:jehandev/wp-base.git <YOUR_PROJECT_FOLDER>cdinto the projectcomposer installnpm installcp .env.example .env, thennano .envand enter/change the variables in this new file :
DB_NAMEDB_USERDB_PASSWORDDB_HOSTWP_ENV(development,stagingorproduction)WP_HOMEWP_SITEURL
- Generate Salts with Roots App and copy/paste them in
.env - Use this command to install WordPress (don't forget to replace the variables) :
wp core install --url=<WEBSITE_URL (be sure to include https:// if needed)> --title=<WEBSITE_TITLE> --admin_user=<USER_NAME> --admin_password=<USER_PASSWORD> --admin_email=<USER_PEMAIL>
- Activate all Plugins :
wp plugin activate --all - Remove every default posts, comments, pages :
wp site empty - Activate the default child-theme :
wp theme activate wp-base-child - Be sure to make your default folder point to
/webin your server configuration, and not on the root folder or this project - You're all set !
- Bedrock
- Timber (Twig)
- Remove WordPress Emojicons
- Disable Auto Paragraphs
- Add slug in body class
- Set Image Meta on Upload (Title / Description / Alt)
- Disable Comments
- Disable email verification
- Remove jQuery Migrate
- Remove Core, Yoast and WordFence dashboard widgets
- Allow SVG Uploads
- Remove Contact Form 7 scripts and styles if no CF7 shortcode in the content
- Remove Dashicons on frontend if user is not admin
- Remove Pingback
- Disable XML-RPC
- Hide WordPress Version
- Remove Unnecessary Header Infos
- Supports :
post-thumbnails,html5,custom-logo,responsive-embeds - Text domain for translations :
wpbase
- Use jjgrainger/posttypes for easy OOP Custom Post Types creation without plugin
- Contact Form 7
- Ewww Image Optimizer
- Query Monitor
- Regenerate Thumbnails
- WordFence
- WP Mail SMTP
- WPS Hide Login
- Yoast SEO
- Use
npm run devornpm run watchto compile assets for development - Use
npm run buildto compile assets for production
@Todo : providing a way to import files from node_modules in css
- PostCSS must be located in the
assets/build/postcssof thewp-base-childfolder, Tailwind is configured directly infrontend.pcss - JavaScript must be located in the
assets/build/js/frontendof thewp-base-childfolder, every file is bundled intodist/js/frontend.js - Images are copied from the
assets/build/imagesto thedist/imagesfolder and optimized withsharpandsvgo - Fonts are copied from the
assets/build/fontsto thedist/fontsfolder
- TailwindCSS
@help-needed : probably far from being perfect and way too permissive I think
{
"parserOptions": {
"ecmaVersion": 2017,
"sourceType": "module",
"ecmaFeatures": {
"jsx": true
}
},
"rules" : {
"camelcase": 1,
"comma-dangle": 2,
"quotes": 0
}
}
Generated with Stylelint Config Generator
"indentation": 4,
"string-quotes": "single",
"no-duplicate-selectors": true,
"color-hex-case": "lower",
"color-hex-length": "long",
"color-named": "never",
"selector-no-qualifying-type": true,
"selector-combinator-space-after": "always",
"selector-attribute-quotes": "always",
"selector-attribute-operator-space-before": "never",
"selector-attribute-operator-space-after": "never",
"selector-attribute-brackets-space-inside": "never",
"declaration-block-trailing-semicolon": "never",
"declaration-colon-space-before": "never",
"declaration-colon-space-after": "always",
"property-no-vendor-prefix": true,
"value-no-vendor-prefix": true,
"number-leading-zero": "always",
"function-url-quotes": "never",
"font-weight-notation": "numeric",
"font-family-name-quotes": "always-where-recommended",
"comment-whitespace-inside": "always",
"comment-empty-line-before": "always",
"at-rule-no-vendor-prefix": true,
"rule-empty-line-before": "always",
"selector-pseudo-element-colon-notation": "double",
"selector-pseudo-class-parentheses-space-inside": "never",
"selector-no-vendor-prefix": true,
"media-feature-range-operator-space-before": "always",
"media-feature-range-operator-space-after": "always",
"media-feature-parentheses-space-inside": "never",
"media-feature-colon-space-before": "never",
"media-feature-colon-space-after": "always"
