Skip to content

Instantly share code, notes, and snippets.

@wplit wplit/shortcode.php
Last active May 23, 2019

What would you like to do?
Shortcode to allow inserting reusable Gutenberg block into Oxygen template
add_shortcode('wp_oxy_reusable_block', 'lit_reusable_block_sc');
* Add a shortcode to allow resuable blocks, that are created in WP editor, to be inserted in Oxygen templates using their IDs
* Sample usage: [wp_oxy_reusable_block id='2543']
function lit_reusable_block_sc( $atts ) {
$attributes = shortcode_atts(
'id' => null
), $atts );
$output = do_blocks( get_the_content('', '', get_post($attributes['id']) ) );
return $output;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.