Skip to content

Instantly share code, notes, and snippets.

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 bahiirwa/bb66e4e9358b1142497346939c2b4f58 to your computer and use it in GitHub Desktop.
Save bahiirwa/bb66e4e9358b1142497346939c2b4f58 to your computer and use it in GitHub Desktop.
Converting Classic Themes to Block Theme. How to use block templates parts
<?php
/**
* Footer template.
* Add this to the HTML template in the parts directory in the theme.
*/
if ( function_exists( 'block_template_part' ) ) {
block_template_part( 'footer-new-blocks' );
}
/**
* Add theme support for block template parts.
* Add this to the functions.php in the theme.
*/
function safaris_block_releated_theme_support() {
add_theme_support( 'block-template-parts' );
}
add_action( 'after_setup_theme', 'safaris_block_releated_theme_support' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment