Themes: Add a Block Themes filter in Theme Install Screen.

The Theme Directory on wordpress.org recently got updated to show a shortcut for filtering block themes. This changeset adds a "Block Themes" filter when adding a new theme from WordPress administration.

It also introduces two new action hooks: `install_themes_pre_blockthemes` (fires before the tab is rendered) and `install_themes_blockthemes` (fires at the top the tab).

Follow-up to [meta11963].

Props luminuu, audrasjb, SergeyBiryukov, rafiahmedd.
Fixes #56283.
See #meta6330.


git-svn-id: https://develop.svn.wordpress.org/trunk@53906 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Jb Audras
2022-08-18 11:43:34 +00:00
parent 4da6f65d88
commit 9341d6980f
2 changed files with 17 additions and 1 deletions
+12 -1
View File
@@ -1694,7 +1694,18 @@ themes.view.Installer = themes.view.Appearance.extend({
browse: function( section ) {
// Create a new collection with the proper theme data
// for each section.
this.collection.query( { browse: section } );
if ( 'blockthemes' === section ) {
var request = { tag: 'full-site-editing' };
// Get the themes by sending Ajax POST request to api.wordpress.org/themes
// or searching the local cache.
this.collection.query( request );
return;
} else {
this.collection.query( { browse: section } );
}
},
// Sorting navigation.