Last active
March 11, 2023 10:05
-
-
Save gmmedia/4b7e754a0f81663c40bf84e157a511cc to your computer and use it in GitHub Desktop.
WordPress: Wiederverwendbaren Block erstellen
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function j0e_register_block_patterns() { | |
if ( class_exists( 'WP_Block_Patterns_Registry' ) ) { | |
register_block_pattern( | |
'j0e-header-pattern', | |
array( | |
'title' => __( 'Überschrift', 'j0e-patterns' ), | |
'description' => _x( 'Hier steht die Beschreibung des Pattern', 'Block pattern description', 'j0e-patterns' ), | |
'categories' => array('hero'), | |
'content' => "<!-- wp:heading --> | |
<h2>Überschrift 1</h2> | |
<!-- /wp:heading -->", | |
) | |
); | |
} | |
} | |
add_action( 'init', 'j0e_register_block_patterns' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment