123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124 |
- <?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_theme_support( 'editor-styles' );
- }
- add_action( 'after_setup_theme', 'boot23_setup' );
- /************************************
- ######### WordPress Widgets #########
- *************************************/
- function boot23_widgets_init() {
- 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_add_editor_styles() {
- add_editor_style([
- 'css/custom.css',
- 'style.css'
- ] );
- }
- add_action( 'admin_init', 'boot23_add_editor_styles' );
- 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_gutenberg_style() {
- echo '<style>.wp-block{max-width:992px;}.wp-block[data-align="wide"]{}.wp-block[data-align="full"]{max-width:none;}.editor-post-title__block .editor-post-title__input,.edit-post-visual-editor, .edit-post-visual-editor p{font-family: Helvetica, Arial, sans-serif;}</style>';
- }
- add_action('admin_head', 'boot23_gutenberg_style');
- 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);
|