Skip to content

Commit

Permalink
Move header & footer filter hook to a separate function
Browse files Browse the repository at this point in the history
  • Loading branch information
rami-elementor committed Nov 29, 2023
1 parent 253d2bc commit 3f24f6b
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
2 changes: 1 addition & 1 deletion footer.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
}

if ( ! function_exists( 'elementor_theme_do_location' ) || ! elementor_theme_do_location( 'footer' ) ) {
if ( apply_filters( 'hello_elementor_header_footer', true ) ) {
if ( hello_elementor_display_header_footer() ) {
if ( did_action( 'elementor/loaded' ) && hello_header_footer_experiment_active() ) {
get_template_part( 'template-parts/dynamic-footer' );
} else {
Expand Down
15 changes: 14 additions & 1 deletion functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,19 @@ function hello_maybe_update_theme_version_in_db() {
}
}

if ( ! function_exists( 'hello_elementor_display_header_footer' ) ) {
/**
* Check whether to display header footer.
*
* @return bool
*/
function hello_elementor_display_header_footer() {
$hello_elementor_header_footer = true;

return apply_filters( 'hello_elementor_header_footer', $hello_elementor_header_footer );
}
}

if ( ! function_exists( 'hello_elementor_scripts_styles' ) ) {
/**
* Theme Scripts & Styles.
Expand Down Expand Up @@ -128,7 +141,7 @@ function hello_elementor_scripts_styles() {
);
}

if ( apply_filters( 'hello_elementor_header_footer', true ) ) {
if ( hello_elementor_display_header_footer() ) {
wp_enqueue_style(
'hello-elementor-header-footer',
get_template_directory_uri() . '/header-footer' . $min_suffix . '.css',
Expand Down
2 changes: 1 addition & 1 deletion header.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

<?php
if ( ! function_exists( 'elementor_theme_do_location' ) || ! elementor_theme_do_location( 'header' ) ) {
if ( apply_filters( 'hello_elementor_header_footer', true ) ) {
if ( hello_elementor_display_header_footer() ) {
if ( did_action( 'elementor/loaded' ) && hello_header_footer_experiment_active() ) {
get_template_part( 'template-parts/dynamic-header' );
} else {
Expand Down

0 comments on commit 3f24f6b

Please sign in to comment.