| sidebar_position | sidebar_label | description | keywords | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
3 |
Block Based Themes |
Introduction to the Block-Based Themes training course. |
|
This training course will walk you through the building of a block-based WordPress theme. By the end, you'll have transformed the 10up Block Theme into a fully functional movie database theme, complete with custom post types, block bindings, editor controls, and interactive blocks.
If you're new to blocks entirely, we recommend starting with our Building Blocks training course first.
- Node.js (>=20.0.0) and npm (>=9.0.0)
- PHP (>=8.3)
- Composer
- MySQL (8+)
- Git
- A code editor
- Basic familiarity with the command line
You can certainly do this course using your development environment of choice, but we recommend LocalWP and have outlined the steps necessary to get started with it below.
- Create a site
- Create a new site
- What's your site's name?
Block Based Theme Training
Advanced options > Local site domain:block-based-theme-training.local- Choose your environment
- Custom
PHP version:8.3.x
Web server:nginx
Database:MYSQL 8+ - Set up WordPress
- Username:
admin
Password:password
Email:example@example.com
Is this a WordPress Multisite?No
https://github.com/10up/block-based-theme-training
Open your terminal and navigate to ~/Local Sites/block-based-theme-training/app/public, or from the LocalWP dashboard screen for the site select Site shell.
rm -rf wp-content
git clone git@github.com:10up/block-based-theme-training.git wp-content
cd wp-content
nvm use && npm install && npm run build && composer install
cd mu-plugins/10up-plugin && composer install
cd ../..
cd themes/10up-block-theme && composer install
cd ../..:::info
Going forward, please work from the wp-content folder when executing commands such as npm run build. The course will later provide additional instructions under the assumption your terminal is in that directory.
:::
Add the following constants to your wp-config.php:
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', false );
define( 'SCRIPT_DEBUG', true );
define( 'WP_DEVELOPMENT_MODE', 'all' );Log in to wp-admin, go to Appearance > Themes, and activate the 10up Block Theme.
At any time, you may also activate the Fueled Movies theme to see the finished product of this training course.
Once your site is set up, import the sample movie and person content. Open the Site Shell from the LocalWP dashboard for your site and run the following. The default import will add 30 movies and a approximately 90 persons. Alternatively, you can choose to import only your favorite films and their stars using the id found in the URL of an IMDB entry (e.g. - tt0094721).
# Recommended default, imports 30 movies and 3 members of their cast.
wp fueled-movies import
# Import only your favorite movies and their stars via the IMDB ID as found in their URL.
# e.g. https://www.imdb.com/title/tt0094721
# These should be movie ID's (not TV shows) as a comma seperated list.
wp fueled-movies import --ids=tt0094721,tt0910970,tt0068646
# Preview without creating posts
wp fueled-movies import --dry-run
# Override default star limit (default: 3 per movie)
wp fueled-movies import --ids=tt0094721 --star-limit=5Visit the frontend at block-based-theme-training.local, you should see the following.
To ensure our content has imported, visit block-based-theme-training.local/movies and block-based-theme-training.local/people.
- Anatomy of a Block Based Theme
- Orientation: The 10up Block Theme
- The Site Editor
- theme.json: Design Tokens and Settings
- Styles: CSS Architecture and Style Variations
- Render Filters and Block Styles
- Understanding the Content Model
- Editor Controls for Post Meta
- Archive Templates and the Card Pattern
- Block Bindings and Single Templates
- Block Extensions: Extending Core Blocks
- Custom Blocks: Description Lists and Movie Runtime
- Interactivity API: Rate a Movie
If you run into issues with this training project, feel free to reach out in Slack to #10up-gutenberg. We also welcome bug reports, suggestions and contributions via the Issues & Discussions tab on GitHub.


