mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-11 20:30:23 +00:00
Add: Template types to the patterns API.
Backports https://github.com/WordPress/gutenberg/pull/45814 into the core. This commit adds a new templateType property to the patterns registration API. This property allows a pattern to specify which template it makes sense on, e.g.: 404, single-post, single-product, category. Props youknowriad, ntsekouras, spacedmonkey. git-svn-id: https://develop.svn.wordpress.org/trunk@55168 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -302,6 +302,7 @@ function _register_remote_theme_patterns() {
|
||||
* - Keywords (comma-separated values)
|
||||
* - Block Types (comma-separated values)
|
||||
* - Post Types (comma-separated values)
|
||||
* - Template Types (comma-separated values)
|
||||
* - Inserter (yes/no)
|
||||
*
|
||||
* @since 6.0.0
|
||||
@@ -318,6 +319,7 @@ function _register_theme_block_patterns() {
|
||||
'blockTypes' => 'Block Types',
|
||||
'postTypes' => 'Post Types',
|
||||
'inserter' => 'Inserter',
|
||||
'templateTypes' => 'Template Types',
|
||||
);
|
||||
|
||||
/*
|
||||
@@ -388,7 +390,7 @@ function _register_theme_block_patterns() {
|
||||
}
|
||||
|
||||
// For properties of type array, parse data as comma-separated.
|
||||
foreach ( array( 'categories', 'keywords', 'blockTypes', 'postTypes' ) as $property ) {
|
||||
foreach ( array( 'categories', 'keywords', 'blockTypes', 'postTypes', 'templateTypes' ) as $property ) {
|
||||
if ( ! empty( $pattern_data[ $property ] ) ) {
|
||||
$pattern_data[ $property ] = array_filter(
|
||||
preg_split(
|
||||
|
||||
Reference in New Issue
Block a user