__( 'Primary' ),
'bottom' =>__( 'Bottom' ),
'top' =>__( 'Top' )
));
add_theme_support( 'html5', array(
'search-form',
'comment-form',
'comment-list',
'caption',
));
add_theme_support( 'customize-selective-refresh-widgets' );
}
add_action( 'after_setup_theme', 'boot23_setup' );
/************************************
######### WordPress Widgets #########
*************************************/
function boot23_widgets_init() {
register_sidebar( array(
'name' => esc_html__( 'Homepage', 'hp-theme' ),
'id' => 'homepage-widget',
'description' => esc_html__( 'Add widgets here.', 'hp-theme' ),
'before_widget' => '',
'before_title' => '
',
) );
register_sidebar( array(
'name' => esc_html__( 'Sidebar', 'hp-theme' ),
'id' => 'sidebar-1',
'description' => esc_html__( 'Add widgets here.', 'hp-theme' ),
'before_widget' => '',
'before_title' => '',
) );
register_sidebar( array(
'name' => esc_html__( 'Footer 1', 'hp-theme' ),
'id' => 'footer-1',
'description' => esc_html__( 'Add widgets here.', 'hp-theme' ),
'before_widget' => '',
'before_title' => '',
) );
register_sidebar( array(
'name' => esc_html__( 'Footer 2', 'hp-theme' ),
'id' => 'footer-2',
'description' => esc_html__( 'Add widgets here.', 'hp-theme' ),
'before_widget' => '',
'before_title' => '',
) );
register_sidebar( array(
'name' => esc_html__( 'Footer 3', 'hp-theme' ),
'id' => 'footer-3',
'description' => esc_html__( 'Add widgets here.', 'hp-theme' ),
'before_widget' => '',
'before_title' => '',
) );
}
add_action( 'widgets_init', 'boot23_widgets_init' );
/**********************************
######## Gutenberg Editor #########
***********************************/
function boot23_gutenberg_scripts() {
wp_enqueue_script( 'hp-editor',
get_stylesheet_directory_uri() . '/js/editor.js',
array( 'wp-blocks', 'wp-dom' ),
filemtime( get_stylesheet_directory() . '/js/editor.js' ), true );
}
add_action( 'enqueue_block_editor_assets', 'boot23_gutenberg_scripts' );
function boot23_add_editor_styles() {
add_theme_support( 'editor-styles' );
add_editor_style([
'css/custom.css',
'style.css'
]);
}
add_action( 'after_setup_theme', 'boot23_add_editor_styles' );
function boot23_block_styles(){
wp_enqueue_style(
'boot23-css',
get_stylesheet_directory_uri() . '/css/custom.css',
array( 'wp-edit-blocks' ),
time()
);
}
add_action( 'enqueue_block_editor_assets', 'boot23_block_styles' );
function boot23_gutenberg_filter_block( $block_content, $block ) {
$block_content = str_replace(
'wp-block-button__link',
'wp-block-button__link btn',
$block_content
);
return $block_content;
}
add_filter( 'render_block', 'boot23_gutenberg_filter_block', 10, 2);
function boot23_allowed_block_types( $allowed_blocks, $post ) {
return array(
'core/paragraph',
'core/image',
'core/heading',
'core/list',
'core/gallery',
'core/list',
'core/cover',
'core/file',
'core/video',
'core/table',
'core/html',
'core/pullquote',
'core/buttons',
'core/text-columns',
'core/more',
'core/separator',
'core/spacer',
'core/shortcode',
'core/embed'
);
}
add_filter( 'allowed_block_types', 'boot23_allowed_block_types', 10, 2 );
function boot23_remove_core_patterns() {
$block_patterns = array (
'core/two-buttons',
'core/three-buttons',
'core/text-two-columns',
'core/text-two-columns-with-images',
'core/text-three-columns-buttons',
'core/two-images',
'core/large-header',
'core/large-header-button',
'core/heading-paragraph',
'core/quote'
);
foreach ( $block_patterns as $bp ):
unregister_block_pattern( $bp );
endforeach;
}
add_action('init', 'boot23_remove_core_patterns');