Header Footer Elementor - Version 1.0.2

Version Description

  • New: Added support for the OceanWP Theme.
  • Fix: Load the elementor header assets corectly in header. This fixes header looking different just when loading the page as previously Elementor would load it's CSS in the footer.
  • Introduced helper functions for rendering and checking the headers to make it simpler to integrate HFE with more themes.
Download this release

Release Info

Developer Nikschavan
Plugin Icon Header Footer Elementor
Version 1.0.2
Comparing to
See all releases

Code changes from version 1.0.1 to 1.0.2

admin/class-hfe-admin.php CHANGED
@@ -107,10 +107,12 @@ class HFE_Admin {
107
* Register meta box(es).
108
*/
109
function ehf_register_metabox() {
110
- add_meta_box( 'ehf-meta-box', __( 'Elementor Header Footer options', 'header-footer-elementor' ), array(
111
- $this,
112
- 'efh_metabox_render',
113
- ), 'elementor-hf', 'normal', 'high' );
114
}
115
116
/**
107
* Register meta box(es).
108
*/
109
function ehf_register_metabox() {
110
+ add_meta_box(
111
+ 'ehf-meta-box', __( 'Elementor Header Footer options', 'header-footer-elementor' ), array(
112
+ $this,
113
+ 'efh_metabox_render',
114
+ ), 'elementor-hf', 'normal', 'high'
115
+ );
116
}
117
118
/**
header-footer-elementor.php CHANGED
@@ -7,21 +7,21 @@
7
* Author URI: https://www.brainstormforce.com/
8
* Text Domain: header-footer-elementor
9
* Domain Path: /languages
10
- * Version: 1.0.1
11
*
12
* @package header-footer-elementor
13
*/
14
15
- /**
16
- * Load the class loader.
17
- */
18
- require_once 'class-header-footer-elementor.php';
19
-
20
- define( 'HFE_VER', '1.0.1' );
21
define( 'HFE_DIR', plugin_dir_path( __FILE__ ) );
22
define( 'HFE_URL', plugins_url( '/', __FILE__ ) );
23
define( 'HFE_PATH', plugin_basename( __FILE__ ) );
24
25
/**
26
* Load the Plugin Class.
27
*/
7
* Author URI: https://www.brainstormforce.com/
8
* Text Domain: header-footer-elementor
9
* Domain Path: /languages
10
+ * Version: 1.0.2
11
*
12
* @package header-footer-elementor
13
*/
14
15
+ define( 'HFE_VER', '1.0.2' );
16
define( 'HFE_DIR', plugin_dir_path( __FILE__ ) );
17
define( 'HFE_URL', plugins_url( '/', __FILE__ ) );
18
define( 'HFE_PATH', plugin_basename( __FILE__ ) );
19
20
+ /**
21
+ * Load the class loader.
22
+ */
23
+ require_once HFE_DIR . '/inc/class-header-footer-elementor.php';
24
+
25
/**
26
* Load the Plugin Class.
27
*/
class-header-footer-elementor.php → inc/class-header-footer-elementor.php RENAMED
@@ -50,7 +50,10 @@ class Header_Footer_Elementor {
50
} elseif ( 'generatepress' == $this->template ) {
51
52
require HFE_DIR . 'themes/generatepress/class-hfe-generatepress-compat.php';
53
- } else {
54
55
add_action( 'admin_notices', array( $this, 'unsupported_theme' ) );
56
add_action( 'network_admin_notices', array( $this, 'unsupported_theme' ) );
@@ -89,6 +92,8 @@ class Header_Footer_Elementor {
89
*/
90
public function includes() {
91
require_once HFE_DIR . 'admin/class-hfe-admin.php';
92
}
93
94
/**
@@ -103,6 +108,14 @@ class Header_Footer_Elementor {
103
*/
104
public function enqueue_scripts() {
105
wp_enqueue_style( 'hfe-style', HFE_URL . 'assets/css/header-footer-elementor.css', array(), HFE_VER );
106
}
107
108
/**
@@ -114,14 +127,11 @@ class Header_Footer_Elementor {
114
*/
115
public function body_class( $classes ) {
116
117
- $header_id = Header_Footer_Elementor::get_settings( 'type_header', '' );
118
- $footer_id = Header_Footer_Elementor::get_settings( 'type_footer', '' );
119
-
120
- if ( '' !== $header_id ) {
121
$classes[] = 'ehf-header';
122
}
123
124
- if ( '' !== $footer_id ) {
125
$classes[] = 'ehf-footer';
126
}
127
@@ -145,8 +155,7 @@ class Header_Footer_Elementor {
145
* Prints the Header content.
146
*/
147
public static function get_header_content() {
148
- $header_id = Header_Footer_Elementor::get_settings( 'type_header', '' );
149
- echo self::$elementor_frontend->get_builder_content_for_display( $header_id );
150
}
151
152
/**
@@ -154,9 +163,8 @@ class Header_Footer_Elementor {
154
*/
155
public static function get_footer_content() {
156
157
- $footer_id = Header_Footer_Elementor::get_settings( 'type_footer', '' );
158
echo "<div class='footer-width-fixer'>";
159
- echo self::$elementor_frontend->get_builder_content_for_display( $footer_id );
160
echo '</div>';
161
}
162
@@ -191,24 +199,26 @@ class Header_Footer_Elementor {
191
return $cached;
192
}
193
194
- $template = new WP_Query( array(
195
- 'post_type' => 'elementor-hf',
196
- 'meta_key' => 'ehf_template_type',
197
- 'meta_value' => $type,
198
- 'meta_type' => 'post',
199
- 'meta_compare' => '>=',
200
- 'orderby' => 'meta_value',
201
- 'order' => 'ASC',
202
- 'meta_query' => array(
203
- 'relation' => 'OR',
204
- array(
205
- 'key' => 'ehf_template_type',
206
- 'value' => $type,
207
- 'compare' => '==',
208
- 'type' => 'post',
209
- )
210
- ),
211
- ) );
212
213
if ( $template->have_posts() ) {
214
$posts = wp_list_pluck( $template->posts, 'ID' );
50
} elseif ( 'generatepress' == $this->template ) {
51
52
require HFE_DIR . 'themes/generatepress/class-hfe-generatepress-compat.php';
53
+ } elseif ( 'oceanwp' == $this->template ) {
54
+
55
+ require HFE_DIR . 'themes/oceanwp/class-hfe-oceanwp-compat.php';
56
+ } elseif ( ! current_theme_supports( 'header-footer-elementor' ) ) {
57
58
add_action( 'admin_notices', array( $this, 'unsupported_theme' ) );
59
add_action( 'network_admin_notices', array( $this, 'unsupported_theme' ) );
92
*/
93
public function includes() {
94
require_once HFE_DIR . 'admin/class-hfe-admin.php';
95
+
96
+ require_once HFE_DIR . 'inc/hfe-functions.php';
97
}
98
99
/**
108
*/
109
public function enqueue_scripts() {
110
wp_enqueue_style( 'hfe-style', HFE_URL . 'assets/css/header-footer-elementor.css', array(), HFE_VER );
111
+
112
+ if ( class_exists( '\Elementor\Post_CSS_File' ) ) {
113
+
114
+ if ( hfe_header_enabled() ) {
115
+ $css_file = new \Elementor\Post_CSS_File( get_hfe_header_id() );
116
+ $css_file->enqueue();
117
+ }
118
+ }
119
}
120
121
/**
127
*/
128
public function body_class( $classes ) {
129
130
+ if ( hfe_header_enabled() ) {
131
$classes[] = 'ehf-header';
132
}
133
134
+ if ( hfe_footer_enabled() ) {
135
$classes[] = 'ehf-footer';
136
}
137
155
* Prints the Header content.
156
*/
157
public static function get_header_content() {
158
+ echo self::$elementor_frontend->get_builder_content_for_display( get_hfe_header_id() );
159
}
160
161
/**
163
*/
164
public static function get_footer_content() {
165
166
echo "<div class='footer-width-fixer'>";
167
+ echo self::$elementor_frontend->get_builder_content_for_display( get_hfe_footer_id() );
168
echo '</div>';
169
}
170
199
return $cached;
200
}
201
202
+ $template = new WP_Query(
203
+ array(
204
+ 'post_type' => 'elementor-hf',
205
+ 'meta_key' => 'ehf_template_type',
206
+ 'meta_value' => $type,
207
+ 'meta_type' => 'post',
208
+ 'meta_compare' => '>=',
209
+ 'orderby' => 'meta_value',
210
+ 'order' => 'ASC',
211
+ 'meta_query' => array(
212
+ 'relation' => 'OR',
213
+ array(
214
+ 'key' => 'ehf_template_type',
215
+ 'value' => $type,
216
+ 'compare' => '==',
217
+ 'type' => 'post',
218
+ ),
219
+ ),
220
+ )
221
+ );
222
223
if ( $template->have_posts() ) {
224
$posts = wp_list_pluck( $template->posts, 'ID' );
inc/hfe-functions.php ADDED
@@ -0,0 +1,110 @@
1
+ <?php
2
+ /**
3
+ * Header Footer Elementor Function
4
+ *
5
+ * @package header-footer-elementor
6
+ */
7
+
8
+ /**
9
+ * Checks if Header is enabled from HFE.
10
+ *
11
+ * @since 1.0.2
12
+ * @return bool True if header is enabled. False if header is not enabled
13
+ */
14
+ function hfe_header_enabled() {
15
+ $header_id = Header_Footer_Elementor::get_settings( 'type_header', '' );
16
+
17
+ if ( '' !== $header_id ) {
18
+ return true;
19
+ }
20
+
21
+ return false;
22
+ }
23
+
24
+ /**
25
+ * Checks if Footer is enabled from HFE.
26
+ *
27
+ * @since 1.0.2
28
+ * @return bool True if header is enabled. False if header is not enabled.
29
+ */
30
+ function hfe_footer_enabled() {
31
+ $footer_id = Header_Footer_Elementor::get_settings( 'type_footer', '' );
32
+
33
+ if ( '' !== $footer_id ) {
34
+ return true;
35
+ }
36
+
37
+ return false;
38
+ }
39
+
40
+ /**
41
+ * Get HFE Header ID
42
+ *
43
+ * @since 1.0.2
44
+ * @return (String|boolean) header id if it is set else returns false.
45
+ */
46
+ function get_hfe_header_id() {
47
+ $header_id = Header_Footer_Elementor::get_settings( 'type_header', '' );
48
+
49
+ if ( '' !== $header_id ) {
50
+ return $header_id;
51
+ }
52
+
53
+ return false;
54
+ }
55
+
56
+ /**
57
+ * Get HFE Footer ID
58
+ *
59
+ * @since 1.0.2
60
+ * @return (String|boolean) header id if it is set else returns false.
61
+ */
62
+ function get_hfe_footer_id() {
63
+ $footer_id = Header_Footer_Elementor::get_settings( 'type_footer', '' );
64
+
65
+ if ( '' !== $footer_id ) {
66
+ return $footer_id;
67
+ }
68
+
69
+ return false;
70
+ }
71
+
72
+ /**
73
+ * Display header markup.
74
+ *
75
+ * @since 1.0.2
76
+ */
77
+ function hfe_render_header() {
78
+
79
+ if ( false == apply_filters( 'enable_hfe_render_header', '__return_true' ) ) {
80
+ return;
81
+ }
82
+
83
+ ?>
84
+ <header id="masthead" itemscope="itemscope" itemtype="http://schema.org/WPHeader">
85
+ <p class="main-title bhf-hidden" itemprop="headline"><a href="<?php echo bloginfo( 'url' ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></p>
86
+ <?php Header_Footer_Elementor::get_header_content(); ?>
87
+ </header>
88
+
89
+ <?php
90
+
91
+ }
92
+
93
+ /**
94
+ * Display footer markup.
95
+ *
96
+ * @since 1.0.2
97
+ */
98
+ function hfe_render_footer() {
99
+
100
+ if ( false == apply_filters( 'enable_hfe_render_footer', '__return_true' ) ) {
101
+ return;
102
+ }
103
+
104
+ ?>
105
+ <footer itemscope="itemscope" itemtype="http://schema.org/WPFooter">
106
+ <?php Header_Footer_Elementor::get_footer_content(); ?>
107
+ </footer>
108
+ <?php
109
+
110
+ }
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: brainstormforce, Nikschavan
3
Tags: elementor, header footer builder, header, footer, page builder, template builder, landing page builder, front-end editor
4
Donate link: https://www.paypal.me/BrainstormForce
5
Requires at least: 3.6
6
- Tested up to: 4.8.0
7
- Stable tag: 1.0.1
8
License: GPLv2 or later
9
License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
@@ -12,7 +12,7 @@ Create Header and Footer for your site using Elementor Page Builder.
12
13
== Description ==
14
15
- Create header and footer of your site easily using [Elementor](https://wordpress.org/plugins/elementor/ "Elementor").
16
17
All you need to do is -
18
@@ -20,20 +20,21 @@ All you need to do is -
20
2. Select the template type to be used for header or footer.
21
3. The template will be used throughout the site as header / footer.
22
23
- = Features of Beaver Builder Header Footer =
24
25
- Create attractive pages and templates that can be displayed as a Header or Footer.
26
- Lets you use a fully customized header or footer across the website.
27
28
The plugin only works with limited number of themes as of now, here is the list of supported themes -
29
30
- 1. <a href="https://wpastra.com/?utm_source=wp-repo&utm_campaign=header-footer-elementor&utm_medium=description">Astra</a> - The Fastest, Most Lightweight &amp; Customizable WordPress Theme.
31
2. GeneratePress Theme.
32
3. Genesis Theme.
33
- 4. Beaver Builder theme.
34
35
= Supported & Actively Developed =
36
- Need help with something? Have an issue to report? [Get in touch](https://github.com/Nikschavan/header-footer-elemento "Header Footer elementor on GitHub"). with us on GitHub.
37
38
Made with love at <a href="https://www.brainstormforce.com/?utm_source=wp-repo&utm_campaign=header-footer-elementor&utm_medium=description">Brainstorm Force</a>!
39
@@ -48,12 +49,15 @@ Made with love at <a href="https://www.brainstormforce.com/?utm_source=wp-repo&u
48
49
= Which themes are supported by this plugin? =
50
51
- 1. <a href="https://wpastra.com/?utm_source=wp-repo&utm_campaign=header-footer-elementor&utm_medium=description">Astra</a> - The Fastest, Most Lightweight &amp; Customizable WordPress Theme.
52
- 2. Beaver Builder Theme.
53
3. Genesis Theme (and should work with most of its child themes).
54
- 4. GeneratePress Theme.
55
56
- = How does this plugin work> =
57
58
1. Go to `Appearance -> Header Footer Builder` to build a header or footer layout using elementor.
59
1. After the layout is ready assign the layout as header or footer using the option `Select the type of template this is` (<a href="https://cloudup.com/clK2sPg9nXK+">screenshot</a>)
@@ -65,8 +69,13 @@ Made with love at <a href="https://www.brainstormforce.com/?utm_source=wp-repo&u
65
66
== Changelog ==
67
68
= 1.0.1 =
69
- - New: Added support for the <a href="https://wpastra.com/?utm_source=wp-repo&utm_campaign=bb-header-footer&utm_medium=description">Astra</a> WordPress theme - The Fastest, Most Lightweight &amp; Customizable WordPress Theme.
70
* Moved the menu under Appearance -> Header Footer Builder.
71
* Fix: Header content getting hidden behind tha page content.
72
* Use Elemenntor's canvas template when designing header and footer layout to have full width experience.
3
Tags: elementor, header footer builder, header, footer, page builder, template builder, landing page builder, front-end editor
4
Donate link: https://www.paypal.me/BrainstormForce
5
Requires at least: 3.6
6
+ Tested up to: 4.8.2
7
+ Stable tag: 1.0.2
8
License: GPLv2 or later
9
License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
12
13
== Description ==
14
15
+ Create header and footer of your site easily using [Elementor](https://goo.gl/qhDrbf "Elementor").
16
17
All you need to do is -
18
20
2. Select the template type to be used for header or footer.
21
3. The template will be used throughout the site as header / footer.
22
23
+ = Features of Header Footer Elementor =
24
25
- Create attractive pages and templates that can be displayed as a Header or Footer.
26
- Lets you use a fully customized header or footer across the website.
27
28
The plugin only works with limited number of themes as of now, here is the list of supported themes -
29
30
+ 1. <a href="https://wpastra.com/?utm_source=wp-repo&utm_campaign=header-footer-elementor&utm_medium=description&bsf=162">Astra</a> - The Fastest, Most Lightweight &amp; Customizable WordPress Theme.
31
2. GeneratePress Theme.
32
3. Genesis Theme.
33
+ 4. OceanWP Theme.
34
+ 5. Beaver Builder theme.
35
36
= Supported & Actively Developed =
37
+ Need help with something? Have an issue to report? [Get in touch](https://github.com/Nikschavan/header-footer-elementor "Header Footer elementor on GitHub"). with us on GitHub.
38
39
Made with love at <a href="https://www.brainstormforce.com/?utm_source=wp-repo&utm_campaign=header-footer-elementor&utm_medium=description">Brainstorm Force</a>!
40
49
50
= Which themes are supported by this plugin? =
51
52
+ 1. <a href="https://wpastra.com/?utm_source=wp-repo&utm_campaign=header-footer-elementor&utm_medium=description&bsf=162">Astra</a> - The Fastest, Most Lightweight &amp; Customizable WordPress Theme.
53
+ 2. GeneratePress Theme.
54
3. Genesis Theme (and should work with most of its child themes).
55
+ 4. OceanWP Theme.
56
+ 5. Beaver Builder theme.
57
+
58
+ If you are a theme developer <a href="https://github.com/Nikschavan/header-footer-elementor/wiki/Adding-Header-Footer-Elementor-support-for-your-theme">here</a> is a quick tutorial on how you can add support for the Header Footer Elementor from your theme.
59
60
+ = How does this plugin work =
61
62
1. Go to `Appearance -> Header Footer Builder` to build a header or footer layout using elementor.
63
1. After the layout is ready assign the layout as header or footer using the option `Select the type of template this is` (<a href="https://cloudup.com/clK2sPg9nXK+">screenshot</a>)
69
70
== Changelog ==
71
72
+ = 1.0.2 =
73
+ - New: Added support for the OceanWP Theme.
74
+ - Fix: Load the elementor header assets corectly in header. This fixes header looking different just when loading the page as previously Elementor would load it's CSS in the footer.
75
+ - Introduced helper functions for rendering and checking the headers to make it simpler to integrate HFE with more themes.
76
+
77
= 1.0.1 =
78
+ - New: Added support for the <a href="https://wpastra.com/?utm_source=wp-repo&utm_campaign=bb-header-footer&utm_medium=description-changelog">Astra</a> WordPress theme - The Fastest, Most Lightweight &amp; Customizable WordPress Theme.
79
* Moved the menu under Appearance -> Header Footer Builder.
80
* Fix: Header content getting hidden behind tha page content.
81
* Use Elemenntor's canvas template when designing header and footer layout to have full width experience.
themes/astra/class-hfe-astra-compat.php CHANGED
@@ -36,17 +36,14 @@ class HFE_Astra_Compat {
36
*/
37
public function hooks() {
38
39
- $header_id = Header_Footer_Elementor::get_settings( 'type_header', '' );
40
- $footer_id = Header_Footer_Elementor::get_settings( 'type_footer', '' );
41
-
42
- if ( '' !== $header_id ) {
43
add_action( 'template_redirect', array( $this, 'astra_setup_header' ), 10 );
44
- add_action( 'astra_header', array( $this, 'add_header_markup' ) );
45
}
46
47
- if ( '' !== $footer_id ) {
48
add_action( 'template_redirect', array( $this, 'astra_setup_footer' ), 10 );
49
- add_action( 'astra_footer', array( $this, 'add_footer_markup' ) );
50
}
51
52
}
@@ -58,19 +55,6 @@ class HFE_Astra_Compat {
58
remove_action( 'astra_header', 'astra_header_markup' );
59
}
60
61
- /**
62
- * Display header markup.
63
- */
64
- public function add_header_markup() {
65
- ?>
66
- <header id="masthead" itemscope="itemscope" itemtype="http://schema.org/WPHeader">
67
- <p class="main-title bhf-hidden" itemprop="headline"><a href="<?php echo bloginfo( 'url' ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></p>
68
- <?php Header_Footer_Elementor::get_header_content(); ?>
69
- </header>
70
-
71
- <?php
72
- }
73
-
74
/**
75
* Disable footer from the theme.
76
*/
@@ -78,19 +62,6 @@ class HFE_Astra_Compat {
78
remove_action( 'astra_footer', 'astra_footer_markup' );
79
}
80
81
- /**
82
- * Display footer markup.
83
- */
84
- public function add_footer_markup() {
85
-
86
- ?>
87
- <footer itemscope="itemscope" itemtype="http://schema.org/WPFooter">
88
- <?php Header_Footer_Elementor::get_footer_content(); ?>
89
- </footer>
90
- <?php
91
- }
92
-
93
-
94
}
95
96
HFE_Astra_Compat::instance();
36
*/
37
public function hooks() {
38
39
+ if ( hfe_header_enabled() ) {
40
add_action( 'template_redirect', array( $this, 'astra_setup_header' ), 10 );
41
+ add_action( 'astra_header', 'hfe_render_header' );
42
}
43
44
+ if ( hfe_footer_enabled() ) {
45
add_action( 'template_redirect', array( $this, 'astra_setup_footer' ), 10 );
46
+ add_action( 'astra_footer', 'hfe_render_footer' );
47
}
48
49
}
55
remove_action( 'astra_header', 'astra_header_markup' );
56
}
57
58
/**
59
* Disable footer from the theme.
60
*/
62
remove_action( 'astra_footer', 'astra_footer_markup' );
63
}
64
65
}
66
67
HFE_Astra_Compat::instance();
themes/bb-theme/class-hfe-bb-theme-compat.php CHANGED
@@ -38,15 +38,12 @@ class HFE_BB_Theme_Compat {
38
*/
39
public function hooks() {
40
41
- $header_id = Header_Footer_Elementor::get_settings( 'type_header', '' );
42
- $footer_id = Header_Footer_Elementor::get_settings( 'type_footer', '' );
43
-
44
- if ( '' !== $header_id ) {
45
add_filter( 'fl_header_enabled', '__return_false' );
46
add_action( 'fl_before_header', array( $this, 'get_header_content' ) );
47
}
48
49
- if ( '' !== $footer_id ) {
50
add_filter( 'fl_footer_enabled', '__return_false' );
51
add_action( 'fl_after_content', array( $this, 'get_footer_content' ) );
52
}
38
*/
39
public function hooks() {
40
41
+ if ( hfe_header_enabled() ) {
42
add_filter( 'fl_header_enabled', '__return_false' );
43
add_action( 'fl_before_header', array( $this, 'get_header_content' ) );
44
}
45
46
+ if ( hfe_footer_enabled() ) {
47
add_filter( 'fl_footer_enabled', '__return_false' );
48
add_action( 'fl_after_content', array( $this, 'get_footer_content' ) );
49
}
themes/generatepress/class-hfe-generatepress-compat.php CHANGED
@@ -38,17 +38,14 @@ class HFE_GeneratePress_Compat {
38
*/
39
public function hooks() {
40
41
- $header_id = Header_Footer_Elementor::get_settings( 'type_header', '' );
42
- $footer_id = Header_Footer_Elementor::get_settings( 'type_footer', '' );
43
-
44
- if ( '' !== $header_id ) {
45
add_action( 'init', array( $this, 'generatepress_setup_header' ), 10 );
46
- add_action( 'generate_header', array( $this, 'get_header_content' ) );
47
}
48
49
- if ( '' !== $footer_id ) {
50
add_action( 'init', array( $this, 'generatepress_setup_footer' ), 10 );
51
- add_action( 'generate_footer', array( $this, 'get_footer_content' ) );
52
}
53
54
}
@@ -68,32 +65,6 @@ class HFE_GeneratePress_Compat {
68
remove_action( 'generate_footer', 'generate_construct_footer' );
69
}
70
71
- /**
72
- * Display header markup for generatepress theme.
73
- */
74
- public function get_header_content() {
75
-
76
- ?>
77
- <header id="masthead" itemscope="itemscope" itemtype="http://schema.org/WPHeader">
78
- <p class="main-title bhf-hidden" itemprop="headline"><a href="<?php echo bloginfo( 'url' ); ?>"
79
- title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>"
80
- rel="home"><?php bloginfo( 'name' ); ?></a></p>
81
- <?php Header_Footer_Elementor::get_header_content(); ?>
82
- </header>
83
- <?php
84
- }
85
-
86
- /**
87
- * Display footer markup for generatepress theme.
88
- */
89
- public function get_footer_content() {
90
- ?>
91
- <footer class="ehf-site-info" itemtype="http://schema.org/WPFooter" itemscope="itemscope">
92
- <?php Header_Footer_Elementor::get_footer_content(); ?>
93
- </footer>
94
- <?php
95
- }
96
-
97
}
98
99
HFE_GeneratePress_Compat::instance();
38
*/
39
public function hooks() {
40
41
+ if ( hfe_header_enabled() ) {
42
add_action( 'init', array( $this, 'generatepress_setup_header' ), 10 );
43
+ add_action( 'generate_header', 'hfe_render_header' );
44
}
45
46
+ if ( hfe_footer_enabled() ) {
47
add_action( 'init', array( $this, 'generatepress_setup_footer' ), 10 );
48
+ add_action( 'generate_footer', 'hfe_render_footer' );
49
}
50
51
}
65
remove_action( 'generate_footer', 'generate_construct_footer' );
66
}
67
68
}
69
70
HFE_GeneratePress_Compat::instance();
themes/genesis/class-hfe-genesis-compat.php CHANGED
@@ -36,17 +36,14 @@ class HFE_Genesis_Compat {
36
*/
37
public function hooks() {
38
39
- $header_id = Header_Footer_Elementor::get_settings( 'type_header', '' );
40
- $footer_id = Header_Footer_Elementor::get_settings( 'type_footer', '' );
41
-
42
- if ( '' !== $header_id ) {
43
add_action( 'init', array( $this, 'genesis_setup_header' ), 10 );
44
add_action( 'genesis_header', array( $this, 'genesis_header_markup_open' ), 16 );
45
add_action( 'genesis_header', array( $this, 'genesis_header_markup_close' ), 25 );
46
add_action( 'genesis_header', array( 'Header_Footer_Elementor', 'get_header_content' ), 16 );
47
}
48
49
- if ( '' !== $footer_id ) {
50
add_action( 'init', array( $this, 'genesis_setup_footer' ), 10 );
51
add_action( 'genesis_footer', array( $this, 'genesis_footer_markup_open' ), 16 );
52
add_action( 'genesis_footer', array( $this, 'genesis_footer_markup_close' ), 25 );
@@ -82,11 +79,13 @@ class HFE_Genesis_Compat {
82
*/
83
public function genesis_header_markup_open() {
84
85
- genesis_markup( array(
86
- 'html5' => '<header %s>',
87
- 'xhtml' => '<div id="header">',
88
- 'context' => 'site-header',
89
- ) );
90
91
genesis_structural_wrap( 'header' );
92
@@ -98,10 +97,12 @@ class HFE_Genesis_Compat {
98
public function genesis_header_markup_close() {
99
100
genesis_structural_wrap( 'header', 'close' );
101
- genesis_markup( array(
102
- 'html5' => '</header>',
103
- 'xhtml' => '</div>',
104
- ) );
105
106
}
107
@@ -110,11 +111,13 @@ class HFE_Genesis_Compat {
110
*/
111
public function genesis_footer_markup_open() {
112
113
- genesis_markup( array(
114
- 'html5' => '<footer %s>',
115
- 'xhtml' => '<div id="footer" class="footer">',
116
- 'context' => 'site-footer',
117
- ) );
118
genesis_structural_wrap( 'footer', 'open' );
119
120
}
@@ -125,10 +128,12 @@ class HFE_Genesis_Compat {
125
public function genesis_footer_markup_close() {
126
127
genesis_structural_wrap( 'footer', 'close' );
128
- genesis_markup( array(
129
- 'html5' => '</footer>',
130
- 'xhtml' => '</div>',
131
- ) );
132
133
}
134
36
*/
37
public function hooks() {
38
39
+ if ( hfe_header_enabled() ) {
40
add_action( 'init', array( $this, 'genesis_setup_header' ), 10 );
41
add_action( 'genesis_header', array( $this, 'genesis_header_markup_open' ), 16 );
42
add_action( 'genesis_header', array( $this, 'genesis_header_markup_close' ), 25 );
43
add_action( 'genesis_header', array( 'Header_Footer_Elementor', 'get_header_content' ), 16 );
44
}
45
46
+ if ( hfe_footer_enabled() ) {
47
add_action( 'init', array( $this, 'genesis_setup_footer' ), 10 );
48
add_action( 'genesis_footer', array( $this, 'genesis_footer_markup_open' ), 16 );
49
add_action( 'genesis_footer', array( $this, 'genesis_footer_markup_close' ), 25 );
79
*/
80
public function genesis_header_markup_open() {
81
82
+ genesis_markup(
83
+ array(
84
+ 'html5' => '<header %s>',
85
+ 'xhtml' => '<div id="header">',
86
+ 'context' => 'site-header',
87
+ )
88
+ );
89
90
genesis_structural_wrap( 'header' );
91
97
public function genesis_header_markup_close() {
98
99
genesis_structural_wrap( 'header', 'close' );
100
+ genesis_markup(
101
+ array(
102
+ 'html5' => '</header>',
103
+ 'xhtml' => '</div>',
104
+ )
105
+ );
106
107
}
108
111
*/
112
public function genesis_footer_markup_open() {
113
114
+ genesis_markup(
115
+ array(
116
+ 'html5' => '<footer %s>',
117
+ 'xhtml' => '<div id="footer" class="footer">',
118
+ 'context' => 'site-footer',
119
+ )
120
+ );
121
genesis_structural_wrap( 'footer', 'open' );
122
123
}
128
public function genesis_footer_markup_close() {
129
130
genesis_structural_wrap( 'footer', 'close' );
131
+ genesis_markup(
132
+ array(
133
+ 'html5' => '</footer>',
134
+ 'xhtml' => '</div>',
135
+ )
136
+ );
137
138
}
139
themes/oceanwp/class-hfe-oceanwp-compat.php ADDED
@@ -0,0 +1,69 @@
1
+ <?php
2
+ /**
3
+ * HFE_OceanWP_Compat setup
4
+ *
5
+ * @package header-footer-elementor
6
+ */
7
+
8
+ /**
9
+ * OceanWP theme compatibility.
10
+ */
11
+ class HFE_OceanWP_Compat {
12
+
13
+ /**
14
+ * Instance of HFE_OceanWP_Compat.
15
+ *
16
+ * @var HFE_OceanWP_Compat
17
+ */
18
+ private static $instance;
19
+
20
+ /**
21
+ * Initiator
22
+ */
23
+ public static function instance() {
24
+
25
+ if ( ! isset( self::$instance ) ) {
26
+ self::$instance = new HFE_OceanWP_Compat();
27
+
28
+ self::$instance->hooks();
29
+ }
30
+
31
+ return self::$instance;
32
+ }
33
+
34
+ /**
35
+ * Run all the Actions / Filters.
36
+ */
37
+ public function hooks() {
38
+
39
+ if ( hfe_header_enabled() ) {
40
+ add_action( 'template_redirect', array( $this, 'setup_header' ), 10 );
41
+ add_action( 'ocean_header', 'hfe_render_header' );
42
+ }
43
+
44
+ if ( hfe_footer_enabled() ) {
45
+ add_action( 'template_redirect', array( $this, 'setup_footer' ), 10 );
46
+ add_action( 'ocean_footer', 'hfe_render_footer' );
47
+ }
48
+
49
+ }
50
+
51
+ /**
52
+ * Disable header from the theme.
53
+ */
54
+ public function setup_header() {
55
+ remove_action( 'ocean_top_bar', 'oceanwp_top_bar_template' );
56
+ remove_action( 'ocean_header', 'oceanwp_header_template' );
57
+ remove_action( 'ocean_page_header', 'oceanwp_page_header_template' );
58
+ }
59
+
60
+ /**
61
+ * Disable footer from the theme.
62
+ */
63
+ public function setup_footer() {
64
+ remove_action( 'ocean_footer', 'oceanwp_footer_template' );
65
+ }
66
+
67
+ }
68
+
69
+ HFE_OceanWP_Compat::instance();