'begro-highlight', 'label' => __('Begro Highlight', 'begro'), ) ); } add_action('init', 'begro_register_block_styles'); function begro_register_block_patterns() { register_block_pattern( 'begro/hero-section', array( 'title' => __('Hero Section', 'begro'), 'description' => __('A simple hero block.', 'begro'), 'content' => '
Welcome to Begro Theme
', ) ); } add_action('init', 'begro_register_block_patterns'); if (! function_exists('begro_setup')) : function begro_setup() { load_theme_textdomain('begro', get_template_directory() . '/languages'); add_theme_support('automatic-feed-links'); add_theme_support('title-tag'); add_theme_support('post-thumbnails'); add_theme_support('html5', array('search-form', 'comment-form', 'comment-list', 'gallery', 'caption', 'script', 'style')); add_theme_support('wp-block-styles'); add_theme_support('responsive-embeds'); add_theme_support('align-wide'); // Enable Classic Widgets based on Customizer if ( get_theme_mod( 'begro_classic_widgets_enable', 0 ) ) { remove_theme_support( 'widgets-block-editor' ); } else { add_theme_support( 'widgets-block-editor' ); } // Enable Classic Editor based on Customizer if ( get_theme_mod( 'begro_classic_editor_enable', 0 ) ) { add_filter( 'use_block_editor_for_post', '__return_false', 100 ); add_filter( 'use_block_editor_for_post_type', '__return_false', 100 ); } /** * Elementor support */ add_theme_support('elementor'); add_theme_support('elementor-pro'); add_theme_support('elementor-theme-builder'); // Add theme support for Elementor color schemes add_theme_support( 'elementor-color-schemes' ); // Add theme support for Elementor typography schemes add_theme_support( 'elementor-typography' ); add_theme_support('custom-logo', array( 'height' => 80, 'width' => 250, 'flex-height' => true, 'flex-width' => true, )); add_theme_support('custom-header', array( 'width' => 1600, 'height' => 400, 'flex-height' => true, 'flex-width' => true, )); add_theme_support('custom-background', array( 'default-color' => 'ffffff', 'default-image' => '', )); add_editor_style('editor-style.css'); register_nav_menus(array( 'primary' => __('Primary Menu', 'begro'), )); } endif; add_action('after_setup_theme', 'begro_setup'); function begro_elementor_editor_styles() { add_editor_style( 'editor-style.css' ); } add_action( 'admin_init', 'begro_elementor_editor_styles' ); /** * Enqueue scripts and styles */ function begro_enqueue_assets() { wp_enqueue_style( 'begro-global', get_template_directory_uri() . '/assets/css/global.css' ); wp_enqueue_style( 'begro-header', get_template_directory_uri() . '/assets/css/header.css', array('begro-global') ); wp_enqueue_style( 'begro-grid', get_template_directory_uri() . '/assets/css/grid.css', array('begro-global') ); wp_enqueue_style( 'begro-nav', get_template_directory_uri() . '/assets/css/nav.css', array('begro-global') ); wp_enqueue_style( 'begro-footer', get_template_directory_uri() . '/assets/css/footer.css', array('begro-global') ); wp_enqueue_style('begro-style', get_stylesheet_uri(), array('begro-global'), wp_get_theme()->get('Version')); // Example local font loading: if you self-host fonts, enqueue them via style or inline @font-face in a file. } add_action('wp_enqueue_scripts', 'begro_enqueue_assets'); function begro_enqueue_comment_reply() { if (is_singular() && comments_open()) { wp_enqueue_script('comment-reply'); } } add_action('wp_enqueue_scripts', 'begro_enqueue_comment_reply'); /** * Register Topbar widget areas only when topbar is enabled */ function begro_topbar_widgets() { // Load the setting $topbar_enabled = get_theme_mod( 'begro_topbar_enable', 0 ); // If disabled → do NOT register widgets if ( ! $topbar_enabled ) { return; } register_sidebar( array( 'name' => __( 'Topbar Left Column', 'begro' ), 'id' => 'topbar-left-column', 'description' => __( 'Widgets in the left column of the topbar.', 'begro' ), 'before_widget' => '', 'before_title' => '