After some of the great sessions at WordCamp US, I was inspired to learn more about some of the block-based themes found on WordPress.org.
The quickest way to view the published block-based themes is to browse the “Full site editing” tag of themes on WordPress.org.
But what if we want a way to quickly download and browse the code of those themes on our own machine?
Listing WordPress themes from the CLI
Examining the requests made from the above page, I noticed that the main content is generated from the response to a call to the
/themes/info endpoint of
Exploring that endpoint a bit with
restclient.el package in Emacs showed that there’s an easy way to get the theme slugs!
Install all Block-themes with curl, jq, and wpcli
So we have a URL, and if we have
jq installed, then we can pipe our way to installing all of the block-themes!
curl https://api.wordpress.org/themes/info/1.2/\?action\=query_themes\&request%5Btag%5D%5B%5D\=full-site-editing\&request%5Bper_page%5D\=50 | jq -r '.themes.slug' | xargs wp theme install
Once those are downloaded, it’s just a matter of listing the themes and activating one!