Created
December 6, 2022 13:37
-
-
Save lordmatt/9115a50154dd0032cfa5da6fbcf1c4b1 to your computer and use it in GitHub Desktop.
This file contains 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 | |
/* | |
* This is just the code as exported from my site where it exists just for me. An example of a more complex pattern for | |
* something a bit more funthan the usual boring patterns. As far as licenses go, GNU GPL3. | |
*/ | |
function matrixdreams_register_my_patterns() { | |
register_block_pattern( | |
'matrixdreams/Dnd-Monster-stat-block', | |
array( | |
'title' => __( 'Monster stat block', 'MatrixDreams' ), | |
'description' => _x( 'Layout of a monster stat block for D&D. There are pleanty of classes added if you want to apply styles to the block.', 'Block pattern description', 'MatrixDreams' ), | |
'content' => '<!-- wp:group {"className":"monster","layout":{"type":"constrained"}} --> | |
<div class="wp-block-group monster"><!-- wp:heading {"className":"monster-name"} --> | |
<h2 class="monster-name">Monster Name (Elder)</h2> | |
<!-- /wp:heading --> | |
<!-- wp:paragraph {"className":"alignment"} --> | |
<p class="alignment"><em>Large beast, neutral</em></p> | |
<!-- /wp:paragraph --> | |
<!-- wp:separator {"backgroundColor":"vivid-red","className":"stat-line is-style-wide"} --> | |
<hr class="wp-block-separator has-text-color has-vivid-red-color has-alpha-channel-opacity has-vivid-red-background-color has-background stat-line is-style-wide"/> | |
<!-- /wp:separator --> | |
<!-- wp:list {"className":"a-monster-list"} --> | |
<ul class="a-monster-list"><!-- wp:list-item --> | |
<li><strong>Amour Class</strong>: 15</li> | |
<!-- /wp:list-item --> | |
<!-- wp:list-item --> | |
<li><strong>Hitpoints</strong>: 26 (10d6+4)</li> | |
<!-- /wp:list-item --> | |
<!-- wp:list-item --> | |
<li><strong>Speed</strong>: 45 ft.</li> | |
<!-- /wp:list-item --></ul> | |
<!-- /wp:list --> | |
<!-- wp:separator {"backgroundColor":"vivid-red","className":"stat-line is-style-wide"} --> | |
<hr class="wp-block-separator has-text-color has-vivid-red-color has-alpha-channel-opacity has-vivid-red-background-color has-background stat-line is-style-wide"/> | |
<!-- /wp:separator --> | |
<!-- wp:table {"hasFixedLayout":true,"className":"is-style-stripes"} --> | |
<figure class="wp-block-table is-style-stripes"><table class="has-fixed-layout"><thead><tr><th class="has-text-align-right" data-align="right"></th><th class="has-text-align-center" data-align="center">STR</th><th class="has-text-align-center" data-align="center">DEX</th><th class="has-text-align-center" data-align="center">CON</th><th class="has-text-align-center" data-align="center">INT</th><th class="has-text-align-center" data-align="center">WIS</th><th class="has-text-align-center" data-align="center">CHA</th></tr></thead><tbody><tr><td class="has-text-align-right" data-align="right"><strong>Stat</strong></td><td class="has-text-align-center" data-align="center">18</td><td class="has-text-align-center" data-align="center">10</td><td class="has-text-align-center" data-align="center">20</td><td class="has-text-align-center" data-align="center">4</td><td class="has-text-align-center" data-align="center">10</td><td class="has-text-align-center" data-align="center">10</td></tr><tr><td class="has-text-align-right" data-align="right"><strong>Bonus</strong></td><td class="has-text-align-center" data-align="center">4</td><td class="has-text-align-center" data-align="center">0</td><td class="has-text-align-center" data-align="center">5</td><td class="has-text-align-center" data-align="center">-3</td><td class="has-text-align-center" data-align="center">0</td><td class="has-text-align-center" data-align="center">0</td></tr><tr><td class="has-text-align-right" data-align="right"><strong>Save</strong></td><td class="has-text-align-center" data-align="center">4</td><td class="has-text-align-center" data-align="center">0</td><td class="has-text-align-center" data-align="center">7</td><td class="has-text-align-center" data-align="center">-3</td><td class="has-text-align-center" data-align="center">2</td><td class="has-text-align-center" data-align="center">0</td></tr></tbody></table></figure> | |
<!-- /wp:table --> | |
<!-- wp:separator {"backgroundColor":"vivid-red","className":"stat-line is-style-wide"} --> | |
<hr class="wp-block-separator has-text-color has-vivid-red-color has-alpha-channel-opacity has-vivid-red-background-color has-background stat-line is-style-wide"/> | |
<!-- /wp:separator --> | |
<!-- wp:list {"className":"a-monster-list"} --> | |
<ul class="a-monster-list"><!-- wp:list-item --> | |
<li><strong>Condition Immunities</strong>: deafened</li> | |
<!-- /wp:list-item --> | |
<!-- wp:list-item --> | |
<li><strong>Senses</strong>: Passive Perception 12</li> | |
<!-- /wp:list-item --> | |
<!-- wp:list-item --> | |
<li><strong>Languages</strong>: None</li> | |
<!-- /wp:list-item --> | |
<!-- wp:list-item --> | |
<li><strong>Challenge</strong>: 1 (225 XP)</li> | |
<!-- /wp:list-item --></ul> | |
<!-- /wp:list --> | |
<!-- wp:separator {"backgroundColor":"vivid-red","className":"stat-line is-style-wide"} --> | |
<hr class="wp-block-separator has-text-color has-vivid-red-color has-alpha-channel-opacity has-vivid-red-background-color has-background stat-line is-style-wide"/> | |
<!-- /wp:separator --> | |
<!-- wp:paragraph {"className":"abilities"} --> | |
<p class="abilities"><strong><em>Custom ability</em></strong>: The monster can do the thing twice</p> | |
<!-- /wp:paragraph --> | |
<!-- wp:separator {"backgroundColor":"vivid-red","className":"stat-line is-style-wide"} --> | |
<hr class="wp-block-separator has-text-color has-vivid-red-color has-alpha-channel-opacity has-vivid-red-background-color has-background stat-line is-style-wide"/> | |
<!-- /wp:separator --> | |
<!-- wp:paragraph {"className":"actions"} --> | |
<p class="actions"><strong><em>Bite</em></strong>: <em>Melee Weapon Attack</em>: +4 to hit, reach 10 ft., one target. Hit 1d8+3 piercing.</p> | |
<!-- /wp:paragraph --> | |
<!-- wp:spacer {"height":"12px","className":"bottom"} --> | |
<div style="height:12px" aria-hidden="true" class="wp-block-spacer bottom"></div> | |
<!-- /wp:spacer --></div> | |
<!-- /wp:group -->', | |
) | |
); | |
} | |
add_action( 'init', 'matrixdreams_register_my_patterns' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment