Skip to content

Instantly share code, notes, and snippets.

@uptheirons78
Created March 10, 2023 09:50
Show Gist options
  • Save uptheirons78/0223fb33149bef36dda56c0d32e67834 to your computer and use it in GitHub Desktop.
Save uptheirons78/0223fb33149bef36dda56c0d32e67834 to your computer and use it in GitHub Desktop.
Register a WordPress Pattern
<?php
/**
* Title: Event Card
* Slug: text-domain/event-card
* Categories: cards
*/
?>
<!-- wp:group {"className":"specifica-opera","layout":{"type":"default"}} -->
<div class="wp-block-group specifica-opera"><!-- wp:heading {"textColor":"hc_azzurro"} -->
<h2 class="has-hc-azzurro-color has-text-color">Missa Brevis in La Maggiore BWV 234</h2>
<!-- /wp:heading -->
<!-- wp:heading {"level":3,"textColor":"hc_azzurro"} -->
<h3 class="has-hc-azzurro-color has-text-color">Cast e team di produzione</h3>
<!-- /wp:heading -->
<!-- wp:paragraph -->
<p><strong>Direzione d'orchestra</strong>: Arman Azemoon<br><strong>Regia</strong>: Giovanni Del Monte<br><strong>Direzione del coro</strong>: Arman Azemoon<br><strong>Pianoforte</strong>: Elisabetta Ferri<br><strong>Flauto</strong>: Laura Pontecorvo<br><strong>Soprano</strong>: Rosaria Angotti<br><strong>Alto</strong>: Simona Braida<br><strong>Basso</strong>: Roberto Curione</p>
<!-- /wp:paragraph -->
<!-- wp:heading {"level":3,"textColor":"hc_azzurro"} -->
<h3 class="has-hc-azzurro-color has-text-color">Informazioni ensemble</h3>
<!-- /wp:heading -->
<!-- wp:paragraph -->
<p><strong>Orchestra</strong>: Orchestra Barocca HT Classical<br><strong>Coro</strong>: L'Ottava Giusta</p>
<!-- /wp:paragraph --></div>
<!-- /wp:group -->
<?php
/**
* Registers block patterns and categories.
*/
function mb_register_block_pattern_categories() {
$block_pattern_categories = array(
'cards' => array( 'label' => __( 'Cards', 'text-domain' ) )
);
/**
* Filters the theme block pattern categories.
*/
$block_pattern_categories = apply_filters( 'mb_block_pattern_categories', $block_pattern_categories );
foreach ( $block_pattern_categories as $name => $properties ) {
if ( ! WP_Block_Pattern_Categories_Registry::get_instance()->is_registered( $name ) ) {
register_block_pattern_category( $name, $properties );
}
}
}
add_action( 'init', 'mb_register_block_pattern_categories', 9 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment