WordPress Development¶
Table of Contents¶
Overview¶
At Lemone, we primarily use the Roots stack for WordPress development: - Bedrock: Modern WordPress stack with better organization - Sage: WordPress starter theme with modern tooling - Trellis: Ansible-based deployment tool
For Roots-specific documentation, see WordPress Roots Stack.
Project Setup¶
Complete setup process for a new WordPress project using the Roots stack.
Prerequisites¶
Tools needed: - PHP 8.0+ - Composer - Node.js & Yarn - Lando (for local development) - Git
Optional: Tiged (copies repositories without git references):
1. GitLab Setup¶
Create project repository:
- Create a group for the company (if it doesn't exist)
- Create new project on codepot.nl
- Use same name as Tresorit folder
- Create branch named
develop - Set default branch to
developin settings - Invite team members
- Clone the project locally
- Create a board for issue tracking
- Download
.gitlabfolder from boilerplate to project root - Import standard WordPress project issues
2. Tresorit Setup¶
Organize design files:
- Create
06-developfolder in Tresorit project - Copy design/Sketch files to develop folder (extend filename with your name)
- Create separate
assets.sketchfile for assets
3. Install Bedrock¶
Create project structure:
# Create project folder
mkdir my-project
cd my-project
# Install Bedrock
composer create-project roots/bedrock site
4. Install Trellis¶
Set up deployment tool:
# Clone Trellis (in project root, not in site/)
degit https://github.com/roots/trellis
# Delete .github folder from Trellis
rm -rf trellis/.github
5. Configure Bedrock¶
Install essential plugins:
cd site
# Install Acorn (Laravel components for WordPress)
composer require roots/acorn
# Install Soil (WordPress plugin to clean up markup)
composer require roots/soil
# Install Sage SVG (easy SVG usage)
composer require log1x/sage-svg
Configure Soil:
Edit site/web/app/themes/your-theme/app/setup.php and add:
6. Install Sage Theme¶
Create theme:
cd site/web/app/themes
# Remove default theme
rm -rf twentytwentythree
# Install Sage with your theme name
composer create-project roots/sage your-theme-name
cd your-theme-name
# Install dependencies
yarn
Configure theme:
- Update
style.csswith theme name and details - Add screenshot:
screenshot.png(project design preview) - Install Sass support (Sage comes with Tailwind by default):
Build theme:
7. Add Lando¶
Create .lando.yml in site/ folder:
name: my-project
recipe: wordpress
config:
php: "8.2"
via: nginx
webroot: web
xdebug: "debug,develop,trace"
services:
database:
type: mariadb:10.6
pma:
type: phpmyadmin
hosts:
- database
Configure environment:
Edit site/.env:
# Copy this file to .env for development with Lando
DB_NAME=wordpress
DB_USER=wordpress
DB_PASSWORD=wordpress
DB_HOST=database
WP_ENV=development
WP_HOME=http://my-project.lndo.site
WP_SITEURL=${WP_HOME}/wp
Setup:
- Duplicate
.envto.env.lando-dev - Add
!.env.lando-devto.gitignoreinsite/folder - Update
bud.config.jsproxy URL to match Lando URL:
8. Start Development Environment¶
cd site
# Update Composer dependencies
lando composer update
# Start Lando
lando start
# Wait for containers to start
9. WordPress Installation¶
Access site at http://my-project.lndo.site and complete installation:
- Language: Nederlands (or your preferred language)
- Site Title: PROJECT NAME
- Username:
admin - Password:
admin - Email:
admin@site.local - Search Engine Visibility: Discourage search engines (checked)
Post-installation:
- Log in to WordPress admin
- Appearance → Themes → Activate your new Sage theme
- Settings → General:
- Check timezone
- Settings → Reading:
- Set homepage and posts page to static pages
10. Finalize¶
# Commit all changes
git add .
git commit -m "chore: initial WordPress project setup"
git push origin develop
Local Admin User¶
Creating Admin User via WP-CLI¶
If you need to create or recreate a local admin user:
Login credentials:
- Username: admin
- Password: admin
Resetting Admin Password¶
If you need to reset an existing admin password:
Common Issues¶
Sage 9: file_get_contents Error (WordPress 6.3+)¶
Error message:
Notice: file_get_contents(): Read of 8192 bytes failed with errno=21 Is a directory in /app/web/wp/wp-includes/functions.php on line 4570
Notice: Error when decoding a JSON file at path /app/web/app/themes/theme/resources: Syntax error in /app/web/wp/wp-includes/functions.php on line 4578
Cause: WordPress 6.3+ looks for theme.json but Sage 9 uses a different structure.
Fix: Add this filter to your functions.php:
add_filter(
"theme_file_path",
function ($path, $file) {
if ($file === "theme.json") {
return false;
}
return $path;
},
0,
2
);
Resources: - Roots Discourse: Sage 9 warnings after WP 6.3 update
Lando Not Starting¶
Check:
1. Docker is running
2. No port conflicts (80, 443, 3306)
3. Run lando rebuild -y to rebuild containers
Theme Not Compiling¶
Check:
1. Node version compatibility (use Node 18+)
2. Run yarn install to ensure dependencies are up to date
3. Clear cache: yarn bud clean
4. Check bud.config.js for syntax errors
Database Connection Error¶
Check:
1. Lando is running: lando start
2. .env file has correct database credentials:
Best Practices¶
- Use Composer for plugins - Install via WPackagist when possible
- Commit composer.lock - Ensures consistent dependencies across environments
- Never commit .env - Use
.env.exampleas template - Use Bedrock directory structure - Keep WordPress core in
web/wp/ - Follow Conventional Commits - Use semantic commit messages
- Test locally first - Always test changes in Lando before deploying
See Also¶
- WordPress Roots Stack - Bedrock, Sage, Trellis specifics
- Lando - Local development environment
- Paid Plugins - Managing paid WordPress plugins
- ACF Development - Advanced Custom Fields
- CSS & SCSS - Styling conventions
- Linting Setup - Code quality tools