This is a WordPress base project with Bedrock, Timber and Laravel Mix.
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 18.20+
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
@Todo : update to Vite instead of Mix
- Use
mixormix watchto compile assets for development - Use
mix --productionto compile assets for production
@Todo : providing a way to import files from node_modules in css
- PostCSS must be located in the
assets/postcssof thewp-base-childfolder - JavaScript must be located in the
assets/jsof thewp-base-childfolder - Images are processed in the
assets/jsof thewp-base-childfolder and optimized withimagemin,imagemin-mozjpeg,imagemin-pngquant,imagemin-svgo,imagemin-webpandimagemin-gifsicle - Fonts are copied from the
assets/fontsto thedist/fontsfolder
- TailwindCSS
These linters are applied when processing files with Laravel Mix.
@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"
