123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186 |
- <?php
- /**********************************
- ######### Setup WordPress #########
- ***********************************/
- require get_template_directory() . '/inc/wp-cleaner.php';
- require get_template_directory() . '/inc/wp-nav-walker.php';
- require get_template_directory() . '/inc/wp-templates.php';
- require get_template_directory() . '/inc/theme.php';
- function boot23_scripts() {
- wp_enqueue_style( 'icons', get_template_directory_uri() . '/css/bootstrap-icons.css' );
- wp_enqueue_style( 'sass', get_template_directory_uri() . '/css/custom.css' );
- wp_enqueue_style( 'style', get_stylesheet_uri() );
- wp_enqueue_script('jquery');
- wp_enqueue_script('script', get_template_directory_uri() . '/js/script.min.js', array(), '', true );
- wp_enqueue_script('init', get_template_directory_uri() . '/js/init.js', array(), '', true );
- if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
- wp_enqueue_script( 'comment-reply' );
- }
- }
- add_action( 'wp_enqueue_scripts', 'boot23_scripts' );
- function boot23_setup() {
- add_theme_support( 'automatic-feed-links' );
- add_theme_support( 'title-tag' );
- add_theme_support( 'post-thumbnails' );
- add_theme_support( 'nav-menus' );
- register_nav_menus( array(
- 'primary' => __( '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' => '<section id="%1$s" class="widget %2$s">',
- 'after_widget' => '</section>',
- 'before_title' => '<h3 class="widget-title">',
- 'after_title' => '</h3>',
- ) );
- register_sidebar( array(
- 'name' => esc_html__( 'Sidebar', 'hp-theme' ),
- 'id' => 'sidebar-1',
- 'description' => esc_html__( 'Add widgets here.', 'hp-theme' ),
- 'before_widget' => '<section id="%1$s" class="widget %2$s">',
- 'after_widget' => '</section>',
- 'before_title' => '<h3 class="widget-title">',
- 'after_title' => '</h3>',
- ) );
- register_sidebar( array(
- 'name' => esc_html__( 'Footer 1', 'hp-theme' ),
- 'id' => 'footer-1',
- 'description' => esc_html__( 'Add widgets here.', 'hp-theme' ),
- 'before_widget' => '<section id="%1$s" class="widget %2$s">',
- 'after_widget' => '</section>',
- 'before_title' => '<h3 class="widget-title">',
- 'after_title' => '</h3>',
- ) );
- register_sidebar( array(
- 'name' => esc_html__( 'Footer 2', 'hp-theme' ),
- 'id' => 'footer-2',
- 'description' => esc_html__( 'Add widgets here.', 'hp-theme' ),
- 'before_widget' => '<section id="%1$s" class="widget %2$s">',
- 'after_widget' => '</section>',
- 'before_title' => '<h3 class="widget-title">',
- 'after_title' => '</h3>',
- ) );
- register_sidebar( array(
- 'name' => esc_html__( 'Footer 3', 'hp-theme' ),
- 'id' => 'footer-3',
- 'description' => esc_html__( 'Add widgets here.', 'hp-theme' ),
- 'before_widget' => '<section id="%1$s" class="widget %2$s">',
- 'after_widget' => '</section>',
- 'before_title' => '<h3 class="widget-title">',
- 'after_title' => '</h3>',
- ) );
- }
- 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');
|