VSCode tasks will automatically run the following commands for you when you open the project. In your terminal tabs to the right, you will automatically see two SSH tunnels open in the /site and /site/web/app/themes/sage directories. You can use these terminals to run commands in the ddev environment e.g.:
# in /var/www/html/web/app/themes/sage
npm run dev- Start the ddev environment
cd site && ddev start- Install dependencies
# in /site
ddev exec "composer install"
ddev exec "npm --prefix web/app/themes/sage install"
ddev exec "composer --working-dir web/app/themes/sage install"
- Build the theme
# in /sit
ddev exec "npm --prefix web/app/themes/sage run build"composer.json pulls ACF Pro from a private repo (lunar-build/advanced-custom-fields-pro). If composer install fails with a 404 downloading wpengine/advanced-custom-fields, or you're never prompted for a token and it just fails silently:
- Delete
site/composer.lock - Re-run
ddev exec "composer install"— this forces Composer to re-resolve and it should prompt for a GitHub token - Generate a token at https://github.com/settings/tokens (needs access to the
lunar-buildorg / the private repo) and paste it in when prompted
Composer caches this token in auth.json (gitignored) so you shouldn't be prompted again after the first successful install.
Once WP install screen has run (site loads, DB set up):
- Grab
ACF_PRO_KEYfrom 1Password and set it insite/.env - Activate ACF Pro plugin in WP admin (Plugins)
- Confirm active theme is Sage (
web/app/themes/sage) — WP admin > Appearance > Themes
Provides an artisan-like CLI for managing ACF fields and blocks in a WordPress project. Checkout the link above for example usage and documentation. See the below example.
Blade file: site/web/app/themes/sage/resources/views/blocks/text-hero.blade.php
This block uses the core/heading and core/paragraph blocks as content. The block is registered in the TextHero.php file and the fields are defined in the fields() method. The block is rendered in the with() method, which passes the block data to the Blade template. The template property defines the default inner blocks for the block.