Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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';

Expand Down Expand Up @@ -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();
44 changes: 44 additions & 0 deletions includes/block-patterns.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?php
/**
* Block editor patterns and styles for Theme Check compatibility.
*
* @package HelloElementor
*/

if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}

if ( ! function_exists( 'hello_elementor_register_block_patterns' ) ) {
/**
* Register minimal block patterns and styles.
*
* @return void
*/
function hello_elementor_register_block_patterns() {
if ( ! function_exists( 'register_block_pattern' ) ) {
return;
}

register_block_pattern(
'hello-elementor/section',
[
'title' => esc_html__( 'Hello Section', 'hello-elementor' ),
'description' => esc_html__( 'A simple content section.', 'hello-elementor' ),
'content' => '<!-- wp:group {"layout":{"type":"constrained"}} --><div class="wp-block-group"><!-- wp:heading --><h2 class="wp-block-heading">' . esc_html__( 'Section title', 'hello-elementor' ) . '</h2><!-- /wp:heading --><!-- wp:paragraph --><p>' . esc_html__( 'Add your content here.', 'hello-elementor' ) . '</p><!-- /wp:paragraph --></div><!-- /wp:group -->',
'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' );
3 changes: 1 addition & 2 deletions includes/elementor-functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -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() ) {
Expand Down
13 changes: 9 additions & 4 deletions template-parts/dynamic-header.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
] );
?>
<header id="site-header" class="site-header dynamic-header <?php echo esc_attr( $header_class ); ?>">
<div class="header-inner">
Expand Down
Loading