Spearhead: fix unregister block pattern bug (#2574)
* Remove calls to unregister. * Fix package name. * Ensure these load after Seedlet so that we can deregister Seedlets block patterns.
This commit is contained in:
parent
031d9f49e4
commit
c826235937
2 changed files with 45 additions and 27 deletions
|
@ -5,7 +5,7 @@
|
|||
* @link https://developer.wordpress.org/themes/basics/theme-functions/
|
||||
*
|
||||
* @package WordPress
|
||||
* @subpackage Sk8prk
|
||||
* @subpackage Spearhead
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
||||
|
|
|
@ -6,34 +6,52 @@
|
|||
* @since 1.0.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Register Block Pattern Category.
|
||||
*/
|
||||
if ( function_exists( 'register_block_pattern_category' ) ) {
|
||||
if ( ! function_exists( 'spearhead_register_block_patterns' ) ) :
|
||||
/**
|
||||
* Sets up support for block patterns and unregisters Seedlet's.
|
||||
*/
|
||||
function spearhead_register_block_patterns() {
|
||||
/**
|
||||
* Register Block Pattern Category.
|
||||
*/
|
||||
if ( function_exists( 'register_block_pattern_category' ) ) {
|
||||
|
||||
unregister_block_pattern_category( 'seedlet' );
|
||||
register_block_pattern_category(
|
||||
'spearhead',
|
||||
array( 'label' => __( 'Spearhead', 'spearhead' ) )
|
||||
);
|
||||
}
|
||||
|
||||
register_block_pattern_category(
|
||||
'spearhead',
|
||||
array( 'label' => __( 'Spearhead', 'spearhead' ) )
|
||||
);
|
||||
}
|
||||
/**
|
||||
* Register Block Patterns.
|
||||
*/
|
||||
if ( function_exists( 'register_block_pattern' ) ) {
|
||||
|
||||
/**
|
||||
* Register Block Patterns.
|
||||
*/
|
||||
if ( function_exists( 'register_block_pattern' ) ) {
|
||||
register_block_pattern(
|
||||
'spearhead/related-posts',
|
||||
array(
|
||||
'title' => __( 'Related Posts', 'spearhead' ),
|
||||
'categories' => array( 'spearhead' ),
|
||||
'content' => '<!-- wp:separator {"className":"is-style-wide"} --><hr class="wp-block-separator is-style-wide"/><!-- /wp:separator --><!-- wp:paragraph {"fontSize":"medium"} --><p class="has-medium-font-size">Related</p><!-- /wp:paragraph --><!-- wp:jetpack/related-posts /-->',
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
unregister_block_pattern( 'seedlet/group-split-background' );
|
||||
unregister_block_pattern( 'seedlet/group-image-overlap' );
|
||||
unregister_block_pattern( 'seedlet/latest-posts-alternating-grid' );
|
||||
/**
|
||||
* Unregister SeedletBlock Pattern Category.
|
||||
*/
|
||||
if ( function_exists( 'unregister_block_pattern_category' ) ) {
|
||||
unregister_block_pattern_category( 'seedlet' );
|
||||
}
|
||||
|
||||
register_block_pattern(
|
||||
'spearhead/related-posts',
|
||||
array(
|
||||
'title' => __( 'Related Posts', 'spearhead' ),
|
||||
'categories' => array( 'spearhead' ),
|
||||
'content' => '<!-- wp:separator {"className":"is-style-wide"} --><hr class="wp-block-separator is-style-wide"/><!-- /wp:separator --><!-- wp:paragraph {"fontSize":"medium"} --><p class="has-medium-font-size">Related</p><!-- /wp:paragraph --><!-- wp:jetpack/related-posts /-->',
|
||||
)
|
||||
);
|
||||
}
|
||||
/**
|
||||
* Unregister Block Patterns from Seedlet.
|
||||
*/
|
||||
if ( function_exists( 'unregister_block_pattern' ) ) {
|
||||
unregister_block_pattern( 'seedlet/group-split-background' );
|
||||
unregister_block_pattern( 'seedlet/group-image-overlap' );
|
||||
unregister_block_pattern( 'seedlet/latest-posts-alternating-grid' );
|
||||
}
|
||||
}
|
||||
endif;
|
||||
add_action( 'after_setup_theme', 'spearhead_register_block_patterns', 12 );
|
||||
|
|
Loading…
Reference in a new issue