Skip to content

Instantly share code, notes, and snippets.

@ibrahim-kardi
Created April 3, 2023 15:55
Show Gist options
  • Save ibrahim-kardi/dda7b553ce303e4b246735fe9b2d2026 to your computer and use it in GitHub Desktop.
Save ibrahim-kardi/dda7b553ce303e4b246735fe9b2d2026 to your computer and use it in GitHub Desktop.
regsiter pattern in the block theme
<?php
register_block_pattern(
'starter/custom-button-pattern',
array(
'title' => __( 'Custom buttons', 'starter' ),
'description' => _x( 'Two horizontal buttons, the left button is filled in, and the right button is outlined.', 'Block pattern description', 'starter' ),
'categories' => array( 'buttons' ),
'content' => '<!-- wp:buttons -->
<div class="wp-block-buttons"><!-- wp:button {"backgroundColor":"vivid-green-cyan"} -->
<div class="wp-block-button"><a class="wp-block-button__link has-vivid-green-cyan-background-color has-background wp-element-button">Custom button</a></div>
<!-- /wp:button --></div>
<!-- /wp:buttons -->',
)
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment