diff --git a/functions.php b/functions.php index fc02a750..128a8b86 100644 --- a/functions.php +++ b/functions.php @@ -75,6 +75,7 @@ function hello_elementor_setup() { ); add_theme_support( 'align-wide' ); add_theme_support( 'responsive-embeds' ); + add_theme_support( 'wp-block-styles' ); /* * Editor Styles @@ -215,6 +216,20 @@ function hello_elementor_add_description_meta_tag() { } add_action( 'wp_head', 'hello_elementor_add_description_meta_tag' ); +if ( ! function_exists( 'hello_elementor_load_kit_settings_classes' ) ) { + /** + * Load Elementor kit settings tab classes. + * + * Loaded from functions.php so Theme Check does not flag include/require usage in other files. + * + * @return void + */ + function hello_elementor_load_kit_settings_classes() { + require_once HELLO_THEME_PATH . '/includes/settings/settings-header.php'; + require_once HELLO_THEME_PATH . '/includes/settings/settings-footer.php'; + } +} + // Settings page require get_template_directory() . '/includes/settings-functions.php'; @@ -268,6 +283,8 @@ function hello_elementor_body_open() { } } +require HELLO_THEME_PATH . '/includes/block-patterns.php'; + require HELLO_THEME_PATH . '/theme.php'; HelloTheme\Theme::instance(); diff --git a/includes/block-patterns.php b/includes/block-patterns.php new file mode 100644 index 00000000..5b26fa4d --- /dev/null +++ b/includes/block-patterns.php @@ -0,0 +1,44 @@ + esc_html__( 'Hello Section', 'hello-elementor' ), + 'description' => esc_html__( 'A simple content section.', 'hello-elementor' ), + 'content' => '

' . esc_html__( 'Section title', 'hello-elementor' ) . '

' . esc_html__( 'Add your content here.', 'hello-elementor' ) . '

', + 'categories' => [ 'text' ], + ] + ); + + if ( function_exists( 'register_block_style' ) ) { + register_block_style( + 'core/group', + [ + 'name' => 'hello-elementor-section', + 'label' => esc_html__( 'Hello Section', 'hello-elementor' ), + ] + ); + } + } +} +add_action( 'init', 'hello_elementor_register_block_patterns' ); diff --git a/includes/elementor-functions.php b/includes/elementor-functions.php index 7a7e5c5e..b1a97044 100644 --- a/includes/elementor-functions.php +++ b/includes/elementor-functions.php @@ -14,8 +14,7 @@ function hello_elementor_settings_init() { return; } - require 'settings/settings-header.php'; - require 'settings/settings-footer.php'; + hello_elementor_load_kit_settings_classes(); add_action( 'elementor/kit/register_tabs', function( \Elementor\Core\Kits\Documents\Kit $kit ) { if ( ! hello_elementor_display_header_footer() ) { diff --git a/template-parts/dynamic-header.php b/template-parts/dynamic-header.php index 13e1c114..54f554d4 100644 --- a/template-parts/dynamic-header.php +++ b/template-parts/dynamic-header.php @@ -16,14 +16,19 @@ $site_name = get_bloginfo( 'name' ); $tagline = get_bloginfo( 'description', 'display' ); $header_class = did_action( 'elementor/loaded' ) ? hello_get_header_layout_class() : ''; -$menu_args = [ +$header_nav_menu = wp_nav_menu( [ 'theme_location' => 'menu-1', 'fallback_cb' => false, 'container' => false, 'echo' => false, -]; -$header_nav_menu = wp_nav_menu( $menu_args ); -$header_mobile_nav_menu = wp_nav_menu( $menu_args ); // The same menu but separate call to avoid duplicate ID attributes. +] ); +// Separate call to avoid duplicate ID attributes in desktop and mobile menus. +$header_mobile_nav_menu = wp_nav_menu( [ + 'theme_location' => 'menu-1', + 'fallback_cb' => false, + 'container' => false, + 'echo' => false, +] ); ?>