Skip to content

Instantly share code, notes, and snippets.

@greghunt
Created June 18, 2022 23:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save greghunt/b923618e02421079b189faaccf545973 to your computer and use it in GitHub Desktop.
Save greghunt/b923618e02421079b189faaccf545973 to your computer and use it in GitHub Desktop.
Generate CSS for Generate Block used outside of the page
<?php
add_filter('generateblocks_do_content', function ($content) {
$part = 'page-header';
$template_part = get_block_template(get_stylesheet() . '//' . $part, 'wp_template_part');
if ($extra = $template_part->content) {
$content = $extra . $content;
}
return $content;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment