To test your theme for block editor support, use the official WordPress theme unit test data, which now includes a full set of all available core blocks.
- [Instructor] Anytime you build a new theme or test an existing theme to make sure everything works correctly, you need actual content to work with. The quickest way of adding content to your site is through the official theme unit test data. This data set adds a long list of posts, pages, menus, and other configurations so you can put your theme through its paces and test it for every eventuality a user might expose it to. For my demo project, I've set up a standard empty WordPress site with a 2019 theme activated.
To install the theme unit test data, I first need to download the file, which I just found on GitHub under WPRT/theme-unit-test. Now as of this recording, the new block tests have not been added to the master branch. So I'm going to go to the blocks branch then select themesunittestdata.wordpress.xml is the file. Then click on Raw to get the actual file itself. And then right click and click Save as and save the file onto my computer. I'll just place it in the Downloads folder 'cause I only need it once.
Now that I have the file, I'll go to the backend of my WordPress site, go to Tools, and Import. Scroll down and find WordPress and click Install Now. This installs the WordPress importer. Then I can run the importer. From here I choose the file I just downloaded. Themeunittestdata.wordpress.xml. Click Upload file and import. Check this Download and import file attachments button. And click Submit. And now the WordPress importer will go through the entire file, pull down all the other image files and media files, and everything else it needs, create a long list of posts, pages, menu items and more, and populate the site with all of that content.
When the process is complete, I can now go back to Posts. And you'll see I now have a long list of posts, including block posts, that cover columns, cover, button, image, gallery, quote et cetera, et cetera. And that means if I now jump to the front end and scroll down, you'll see here we have all the types of content that we may see in a site powered by blocks. So here we have all the different columns that are possible. Scrolling down we have the cover block, we have different buttons, images, and the list goes on.
Our goal in this course will be to make the blocks in these posts and pages behave the same way or similar to what they do in 2019 in our custom theme.
- Declaring support for default block styles
- Adding support and styles for wide alignment
- Supporting theme-specific colors and fonts
- Extending block styles
- Adding new style variations