Header Footer Elementor - Version 1.0.0

Version Description

Download this release

Release Info

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

Version 1.0.0

admin/class-hfe-admin-ui.php ADDED
@@ -0,0 +1,205 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Entry point for the plugin. Checks if Elementor is installed and activated and loads it's own files and actions.
4
+ *
5
+ * @package header-footer-elementor
6
+ */
7
+
8
+ defined( 'ABSPATH' ) or exit;
9
+
10
+ /**
11
+ * HFE_Admin setup
12
+ *
13
+ * @since 1.0
14
+ */
15
+ class HFE_Admin {
16
+
17
+ /**
18
+ * Instance of HFE_Admin
19
+ *
20
+ * @var HFE_Admin
21
+ */
22
+ private static $_instance = null;
23
+
24
+ /**
25
+ * Instance of HFE_Admin
26
+ *
27
+ * @return HFE_Admin Instance of HFE_Admin
28
+ */
29
+ public static function instance() {
30
+ if ( ! isset( self::$_instance ) ) {
31
+ self::$_instance = new self;
32
+ }
33
+
34
+ return self::$_instance;
35
+ }
36
+
37
+ /**
38
+ * Constructor
39
+ */
40
+ private function __construct() {
41
+ add_action( 'init', array( $this, 'header_footer_posttype' ) );
42
+ add_action( 'admin_menu', array( $this, 'register_admin_menu' ), 50 );
43
+ add_action( 'add_meta_boxes', array( $this, 'ehf_register_metabox' ) );
44
+ add_action( 'save_post', array( $this, 'ehf_save_meta' ) );
45
+ add_action( 'admin_notices', array( $this, 'location_notice' ) );
46
+
47
+ add_action( 'template_redirect', array( $this, 'block_template_frontend' ) );
48
+ }
49
+
50
+ /**
51
+ * Register Post type for header footer templates
52
+ */
53
+ public function header_footer_posttype() {
54
+
55
+ $labels = array(
56
+ 'name' => __( 'Header / Footers Template', 'header-footer-elementor' ),
57
+ 'singular_name' => __( 'Elementor Header Footer', 'header-footer-elementor' ),
58
+ 'menu_name' => __( 'Header / Footers Template', 'header-footer-elementor' ),
59
+ 'name_admin_bar' => __( 'Elementor Header Footer', 'header-footer-elementor' ),
60
+ 'add_new' => __( 'Add New', 'header-footer-elementor' ),
61
+ 'add_new_item' => __( 'Add New Header Footer', 'header-footer-elementor' ),
62
+ 'new_item' => __( 'New Header / Footers Template', 'header-footer-elementor' ),
63
+ 'edit_item' => __( 'Edit Header / Footers Template', 'header-footer-elementor' ),
64
+ 'view_item' => __( 'View Header / Footers Template', 'header-footer-elementor' ),
65
+ 'all_items' => __( 'All Elementor Header Footers', 'header-footer-elementor' ),
66
+ 'search_items' => __( 'Search Recipes', 'header-footer-elementor' ),
67
+ 'parent_item_colon' => __( 'Parent Recipes:', 'header-footer-elementor' ),
68
+ 'not_found' => __( 'No recipes found.', 'header-footer-elementor' ),
69
+ 'not_found_in_trash' => __( 'No recipes found in Trash.', 'header-footer-elementor' ),
70
+ );
71
+
72
+ $args = array(
73
+ 'labels' => $labels,
74
+ 'public' => true,
75
+ 'rewrite' => false,
76
+ 'show_ui' => true,
77
+ 'show_in_menu' => false,
78
+ 'show_in_nav_menus' => false,
79
+ 'exclude_from_search' => true,
80
+ 'capability_type' => 'post',
81
+ 'hierarchical' => false,
82
+ 'menu_icon' => 'dashicons-editor-kitchensink',
83
+ 'supports' => array( 'title', 'thumbnail', 'elementor' ),
84
+ );
85
+
86
+ register_post_type( 'elementor-hf', $args );
87
+ }
88
+
89
+ public function register_admin_menu() {
90
+ add_submenu_page(
91
+ 'options-general.php',
92
+ __( 'Header Footer Templates', 'elementor', 'header-footer-elementor' ),
93
+ __( 'Header Footer Templates', 'elementor', 'header-footer-elementor' ),
94
+ 'edit_pages',
95
+ 'edit.php?post_type=elementor-hf'
96
+ );
97
+ }
98
+
99
+ /**
100
+ * Register meta box(es).
101
+ */
102
+ function ehf_register_metabox() {
103
+ add_meta_box( 'ehf-meta-box', __( 'Elementor Header Footer options', 'header-footer-elementor' ), array(
104
+ $this,
105
+ 'efh_metabox_render',
106
+ ), 'elementor-hf', 'normal', 'high' );
107
+ }
108
+
109
+ /**
110
+ * Render Meta field.
111
+ *
112
+ * @param POST $post Currennt post object which is being displayed.
113
+ */
114
+ function efh_metabox_render( $post ) {
115
+ $values = get_post_custom( $post->ID );
116
+ $selected = isset( $values['ehf_template_type'] ) ? esc_attr( $values['ehf_template_type'][0] ) : '';
117
+ // We'll use this nonce field later on when saving.
118
+ wp_nonce_field( 'ehf_meta_nounce', 'ehf_meta_nounce' );
119
+ ?>
120
+ <p>
121
+ <label for="ehf_template_type">Select the type of template this is</label>
122
+ <select name="ehf_template_type" id="ehf_template_type">
123
+ <option value="" <?php selected( $selected, '' ); ?>>Select Option</option>
124
+ <option value="type_header" <?php selected( $selected, 'type_header' ); ?>>Header</option>
125
+ <option value="type_footer" <?php selected( $selected, 'type_footer' ); ?>>Footer</option>
126
+ </select>
127
+ </p>
128
+ <?php
129
+ }
130
+
131
+ /**
132
+ * Save meta field.
133
+ *
134
+ * @param POST $post_id Currennt post object which is being displayed.
135
+ * @return Void
136
+ */
137
+ public function ehf_save_meta( $post_id ) {
138
+
139
+ // Bail if we're doing an auto save.
140
+ if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
141
+ return;
142
+ }
143
+
144
+ // if our nonce isn't there, or we can't verify it, bail.
145
+ if ( ! isset( $_POST['ehf_meta_nounce'] ) || ! wp_verify_nonce( $_POST['ehf_meta_nounce'], 'ehf_meta_nounce' ) ) {
146
+ return;
147
+ }
148
+
149
+ // if our current user can't edit this post, bail.
150
+ if ( ! current_user_can( 'edit_posts' ) ) {
151
+ return;
152
+ }
153
+
154
+ if ( isset( $_POST['ehf_template_type'] ) ) {
155
+ update_post_meta( $post_id, 'ehf_template_type', esc_attr( $_POST['ehf_template_type'] ) );
156
+ }
157
+
158
+
159
+ }
160
+
161
+ public function location_notice() {
162
+
163
+ global $pagenow;
164
+ global $post;
165
+
166
+ if ( 'post.php' != $pagenow || ! is_object( $post ) || 'header-footer-elementor' != $post->post_type ) {
167
+ return;
168
+ }
169
+
170
+ $template_type = get_post_meta( $post->ID, 'ehf_template_type', true );
171
+
172
+ if ( '' !== $template_type ) {
173
+ $templates = Header_Footer_Elementor::get_template_id( $template_type );
174
+
175
+ // Check if more than one template is selected for current template type.
176
+ if ( is_array( $templates ) && isset( $templates[1] ) && $post->ID != $templates[0] ) {
177
+
178
+ $post_title = '<strong>' . get_the_title( $templates[0] ) . '</strong>';
179
+ $template_location = '<strong>' . $this->template_location( $template_type ) . '</strong>';
180
+
181
+ $message = __( sprintf( 'Template %s is already assigned to the location %s', $post_title, $template_location ), 'header-footer-elementor' );
182
+
183
+ echo '<div class="error"><p>';
184
+ echo $message;
185
+ echo '</p></div>';
186
+ }
187
+ }
188
+
189
+ }
190
+
191
+ public function template_location( $template_type ) {
192
+ $template_type = ucfirst( str_replace( 'type_', '', $template_type ) );
193
+ return $template_type;
194
+ }
195
+
196
+ public function block_template_frontend() {
197
+ if ( is_singular( 'elementor-hf' ) && ! current_user_can( 'edit_posts' ) ) {
198
+ wp_redirect( site_url(), 301 );
199
+ die;
200
+ }
201
+ }
202
+
203
+ }
204
+
205
+ HFE_Admin::instance();
assets/css/header-footer-elementor.css ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .footer-width-fixer {
2
+ width: 100%;
3
+ }
4
+
5
+ /* Container fix for genesis themes */
6
+
7
+ .ehf-template-genesis.ehf-header .site-header .wrap,
8
+ .ehf-template-genesis.ehf-footer .site-footer .wrap,
9
+ .ehf-template-generatepress.ehf-header .site-header .inside-header {
10
+ width: 100%;
11
+ padding: 0;
12
+ max-width: 100%;
13
+ }
14
+
15
+ /* Container fix for generatepress theme */
16
+
17
+ .ehf-template-generatepress.ehf-header .site-header,
18
+ .ehf-template-generatepress.ehf-footer .site-footer {
19
+ width: 100%;
20
+ padding: 0;
21
+ max-width: 100%;
22
+ background-color: transparent !important; /* override generatepress default white color for header */
23
+ }
24
+
25
+ .bhf-hidden {
26
+ display: none
27
+ }
class-header-footer-elementor.php ADDED
@@ -0,0 +1,219 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Entry point for the plugin. Checks if Elementor is installed and activated and loads it's own files and actions.
4
+ *
5
+ * @package header-footer-elementor
6
+ */
7
+
8
+ /**
9
+ * Class Header_Footer_Elementor
10
+ */
11
+ class Header_Footer_Elementor {
12
+
13
+ /**
14
+ * Current theme template
15
+ *
16
+ * @var String
17
+ */
18
+ public $template;
19
+
20
+ /**
21
+ * Instance of Elemenntor Frontend class.
22
+ *
23
+ * @var \Elementor\Frontend()
24
+ */
25
+ private static $elementor_frontend;
26
+
27
+ /**
28
+ * Constructor
29
+ */
30
+ function __construct() {
31
+
32
+ $this->template = get_template();
33
+
34
+ if ( defined( 'ELEMENTOR_VERSION' ) ) {
35
+
36
+ self::$elementor_frontend = new \Elementor\Frontend();
37
+
38
+ $this->includes();
39
+ $this->load_textdomain();
40
+
41
+ if ( 'genesis' == $this->template ) {
42
+
43
+ require HFE_DIR . 'themes/genesis/class-genesis-compat.php';
44
+ } elseif ( 'bb-theme' == $this->template || 'beaver-builder-theme' == $this->template ) {
45
+ $this->template = 'beaver-builder-theme';
46
+ require HFE_DIR . 'themes/bb-theme/class-bb-theme-compat.php';
47
+ } elseif ( 'generatepress' == $this->template ) {
48
+
49
+ require HFE_DIR . 'themes/generatepress/generatepress-compat.php';
50
+ } else {
51
+
52
+ add_action( 'admin_notices', array( $this, 'unsupported_theme' ) );
53
+ add_action( 'network_admin_notices', array( $this, 'unsupported_theme' ) );
54
+ }
55
+
56
+ // Scripts and styles.
57
+ add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
58
+ add_filter( 'body_class', array( $this, 'body_class' ) );
59
+
60
+ } else {
61
+
62
+ add_action( 'admin_notices', array( $this, 'elementor_not_available' ) );
63
+ add_action( 'network_admin_notices', array( $this, 'elementor_not_available' ) );
64
+ }
65
+ }
66
+
67
+ /**
68
+ * Prints the admin notics when Elementor is not installed or activated.
69
+ */
70
+ public function elementor_not_available() {
71
+
72
+ if ( file_exists( WP_PLUGIN_DIR . '/elementor/elementor.php' ) ) {
73
+ $url = network_admin_url() . 'plugins.php?s=elementor';
74
+ } else {
75
+ $url = network_admin_url() . 'plugin-install.php?s=elementor';
76
+ }
77
+
78
+ echo '<div class="notice notice-error">';
79
+ echo '<p>' . sprintf( __( 'The <strong>Header Footer Elementor</strong> plugin requires <strong><a href="%s">Elementor</strong></a> plugin installed & activated.', 'header-footer-elementor' ) . '</p>', $url );
80
+ echo '</div>';
81
+ }
82
+
83
+ /**
84
+ * Loads the globally required files for the plugin.
85
+ */
86
+ public function includes() {
87
+ require_once HFE_DIR . 'admin/class-hfe-admin-ui.php';
88
+ }
89
+
90
+ /**
91
+ * Loads textdomain for the plugin.
92
+ */
93
+ public function load_textdomain() {
94
+ load_plugin_textdomain( 'header-footer-elementor' );
95
+ }
96
+
97
+ /**
98
+ * Enqueue styles and scripts.
99
+ */
100
+ public function enqueue_scripts() {
101
+ wp_enqueue_style( 'hfe-style', HFE_URL . 'assets/css/header-footer-elementor.css', array(), HFE_VER );
102
+ }
103
+
104
+ /**
105
+ * Adds classes to the body tag conditionally.
106
+ *
107
+ * @param Array $classes array with class names for the body tag.
108
+ *
109
+ * @return Array array with class names for the body tag.
110
+ */
111
+ public function body_class( $classes ) {
112
+
113
+ $header_id = Header_Footer_Elementor::get_settings( 'type_header', '' );
114
+ $footer_id = Header_Footer_Elementor::get_settings( 'type_footer', '' );
115
+
116
+ if ( '' !== $header_id ) {
117
+ $classes[] = 'ehf-header';
118
+ }
119
+
120
+ if ( '' !== $footer_id ) {
121
+ $classes[] = 'ehf-footer';
122
+ }
123
+
124
+ $classes[] = 'ehf-template-' . $this->template;
125
+ $classes[] = 'ehf-stylesheet-' . get_stylesheet();
126
+
127
+ return $classes;
128
+ }
129
+
130
+ /**
131
+ * Prints an admin notics oif the currently installed theme is not supported by header-footer-elementor.
132
+ */
133
+ public function unsupported_theme() {
134
+ $class = 'notice notice-error';
135
+ $message = __( 'Hey, your current theme is not supported by Header Footer Elementor, click <a href="https://github.com/Nikschavan/header-footer-elementor#which-themes-are-supported-by-this-plugin">here</a> to check out the supported themes.', 'header-footer-elementor' );
136
+
137
+ printf( '<div class="%1$s"><p>%2$s</p></div>', $class, $message );
138
+ }
139
+
140
+ /**
141
+ * Prints the Header content.
142
+ */
143
+ public static function get_header_content() {
144
+ $header_id = Header_Footer_Elementor::get_settings( 'type_header', '' );
145
+ echo self::$elementor_frontend->get_builder_content_for_display( $header_id );
146
+ }
147
+
148
+ /**
149
+ * Prints the Footer content.
150
+ */
151
+ public static function get_footer_content() {
152
+
153
+ $footer_id = Header_Footer_Elementor::get_settings( 'type_footer', '' );
154
+ echo "<div class='footer-width-fixer'>";
155
+ echo self::$elementor_frontend->get_builder_content_for_display( $footer_id );
156
+ echo '</div>';
157
+ }
158
+
159
+ /**
160
+ * Get option for the plugin settings
161
+ *
162
+ * @param mixed $setting Option name.
163
+ * @param mixed $default Default value to be received if the option value is not stored in the option.
164
+ *
165
+ * @return mixed.
166
+ */
167
+ public static function get_settings( $setting = '', $default = '' ) {
168
+ if ( 'type_header' == $setting || 'type_footer' == $setting ) {
169
+ $templates = self::get_template_id( $setting );
170
+
171
+ return is_array( $templates ) ? $templates[0] : '';
172
+ }
173
+ }
174
+
175
+ /**
176
+ * Get header or footer template id based on the meta query.
177
+ *
178
+ * @param String $type Type of the template header/footer.
179
+ *
180
+ * @return Mixed Returns the header or footer template id if found, else returns string ''.
181
+ */
182
+ public static function get_template_id( $type ) {
183
+
184
+ $cached = wp_cache_get( $type );
185
+
186
+ if ( false !== $cached ) {
187
+ return $cached;
188
+ }
189
+
190
+ $template = new WP_Query( array(
191
+ 'post_type' => 'elementor-hf',
192
+ 'meta_key' => 'ehf_template_type',
193
+ 'meta_value' => $type,
194
+ 'meta_type' => 'post',
195
+ 'meta_compare' => '>=',
196
+ 'orderby' => 'meta_value',
197
+ 'order' => 'ASC',
198
+ 'meta_query' => array(
199
+ 'relation' => 'OR',
200
+ array(
201
+ 'key' => 'ehf_template_type',
202
+ 'value' => $type,
203
+ 'compare' => '==',
204
+ 'type' => 'post',
205
+ )
206
+ ),
207
+ ) );
208
+
209
+ if ( $template->have_posts() ) {
210
+ $posts = wp_list_pluck( $template->posts, 'ID' );
211
+ wp_cache_set( $type, $posts );
212
+
213
+ return $posts;
214
+ }
215
+
216
+ return '';
217
+ }
218
+
219
+ }
header-footer-elementor.php ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Plugin Name: Header Footer Elementor
4
+ * Plugin URI: https://github.com/Nikschavan/header-footer-elemento
5
+ * Description: Create Header and Footer for your site using Elementor Page Builder.
6
+ * Author: Brainstorm Force, Nikhil Chavan
7
+ * Author URI: https://www.brainstormforce.com/
8
+ * Text Domain: header-footer-elementor
9
+ * Domain Path: /languages
10
+ * Version: 1.0.0
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.0' );
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
+ */
28
+ function hfe_init() {
29
+ new Header_Footer_Elementor();
30
+ }
31
+
32
+ add_action( 'plugins_loaded', 'hfe_init' );
languages/header-footer-elementor.pot ADDED
@@ -0,0 +1,116 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright (C) 2017 Brainstorm Force, Nikhil Chavan
2
+ # This file is distributed under the same license as the Header Footer Elementor package.
3
+ msgid ""
4
+ msgstr ""
5
+ "Project-Id-Version: Header Footer Elementor 1.0.0\n"
6
+ "Report-Msgid-Bugs-To: "
7
+ "https://wordpress.org/support/plugin/header-footer-elementor\n"
8
+ "POT-Creation-Date: 2017-03-07 08:24:30+00:00\n"
9
+ "MIME-Version: 1.0\n"
10
+ "Content-Type: text/plain; charset=utf-8\n"
11
+ "Content-Transfer-Encoding: 8bit\n"
12
+ "PO-Revision-Date: 2017-MO-DA HO:MI+ZONE\n"
13
+ "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14
+ "Language-Team: LANGUAGE <LL@li.org>\n"
15
+ "X-Generator: grunt-wp-i18n 0.5.4\n"
16
+ "X-Poedit-KeywordsList: "
17
+ "__;_e;_x:1,2c;_ex:1,2c;_n:1,2;_nx:1,2,4c;_n_noop:1,2;_nx_noop:1,2,3c;esc_"
18
+ "attr__;esc_html__;esc_attr_e;esc_html_e;esc_attr_x:1,2c;esc_html_x:1,2c;\n"
19
+ "Language: en\n"
20
+ "Plural-Forms: nplurals=2; plural=(n != 1);\n"
21
+ "X-Poedit-Country: United States\n"
22
+ "X-Poedit-SourceCharset: UTF-8\n"
23
+ "X-Poedit-Basepath: ../\n"
24
+ "X-Poedit-SearchPath-0: .\n"
25
+ "X-Poedit-Bookmarks: \n"
26
+ "X-Textdomain-Support: yes\n"
27
+
28
+ #: admin/class-hfe-admin-ui.php:56 admin/class-hfe-admin-ui.php:58
29
+ msgid "Header / Footers Template"
30
+ msgstr ""
31
+
32
+ #: admin/class-hfe-admin-ui.php:57 admin/class-hfe-admin-ui.php:59
33
+ msgid "Elementor Header Footer"
34
+ msgstr ""
35
+
36
+ #: admin/class-hfe-admin-ui.php:60
37
+ msgid "Add New"
38
+ msgstr ""
39
+
40
+ #: admin/class-hfe-admin-ui.php:61
41
+ msgid "Add New Header Footer"
42
+ msgstr ""
43
+
44
+ #: admin/class-hfe-admin-ui.php:62
45
+ msgid "New Header / Footers Template"
46
+ msgstr ""
47
+
48
+ #: admin/class-hfe-admin-ui.php:63
49
+ msgid "Edit Header / Footers Template"
50
+ msgstr ""
51
+
52
+ #: admin/class-hfe-admin-ui.php:64
53
+ msgid "View Header / Footers Template"
54
+ msgstr ""
55
+
56
+ #: admin/class-hfe-admin-ui.php:65
57
+ msgid "All Elementor Header Footers"
58
+ msgstr ""
59
+
60
+ #: admin/class-hfe-admin-ui.php:66
61
+ msgid "Search Recipes"
62
+ msgstr ""
63
+
64
+ #: admin/class-hfe-admin-ui.php:67
65
+ msgid "Parent Recipes:"
66
+ msgstr ""
67
+
68
+ #: admin/class-hfe-admin-ui.php:68
69
+ msgid "No recipes found."
70
+ msgstr ""
71
+
72
+ #: admin/class-hfe-admin-ui.php:69
73
+ msgid "No recipes found in Trash."
74
+ msgstr ""
75
+
76
+ #: admin/class-hfe-admin-ui.php:92 admin/class-hfe-admin-ui.php:93
77
+ msgid "Header Footer Templates"
78
+ msgstr ""
79
+
80
+ #: admin/class-hfe-admin-ui.php:103
81
+ msgid "Elementor Header Footer options"
82
+ msgstr ""
83
+
84
+ #: class-header-footer-elementor.php:79
85
+ msgid ""
86
+ "The <strong>Header Footer Elementor</strong> plugin requires <strong><a "
87
+ "href=\"%s\">Elementor</strong></a> plugin installed & activated."
88
+ msgstr ""
89
+
90
+ #: class-header-footer-elementor.php:135
91
+ msgid ""
92
+ "Hey, your current theme is not supported by Header Footer Elementor, click "
93
+ "<a "
94
+ "href=\"https://github.com/Nikschavan/header-footer-elementor#which-themes-"
95
+ "are-supported-by-this-plugin\">here</a> to check out the supported themes."
96
+ msgstr ""
97
+
98
+ #. Plugin Name of the plugin/theme
99
+ msgid "Header Footer Elementor"
100
+ msgstr ""
101
+
102
+ #. Plugin URI of the plugin/theme
103
+ msgid "https://github.com/Nikschavan/header-footer-elemento"
104
+ msgstr ""
105
+
106
+ #. Description of the plugin/theme
107
+ msgid "Create Header and Footer for your site using Elementor Page Builder."
108
+ msgstr ""
109
+
110
+ #. Author of the plugin/theme
111
+ msgid "Brainstorm Force, Nikhil Chavan"
112
+ msgstr ""
113
+
114
+ #. Author URI of the plugin/theme
115
+ msgid "https://www.brainstormforce.com/"
116
+ msgstr ""
readme.txt ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ === Header Footer Elementor ===
2
+ 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.7.3
7
+ Stable tag: 1.0.0
8
+ License: GPLv2 or later
9
+ License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
+
11
+ 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
+ The plugin only works with limited number of themes as of now, here is the list of supported themes -
18
+
19
+ 1. GeneratePress Theme
20
+ 2. Genesis Theme
21
+ 3. Beaver Builder theme
22
+
23
+ = Supported & Actively Developed =
24
+ 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.
25
+
26
+ == Installation ==
27
+
28
+ 1. Upload the plugin files to the `/wp-content/plugins/header-footer-elementor` directory, or install the plugin through the WordPress plugins screen directly.
29
+ 1. Activate the plugin through the 'Plugins' screen in WordPress
30
+ 1. Use the Settings->Page Builder-> Header Footer Elemenntor to select the page to be displayed as header and footer.
31
+
32
+ == Frequently Asked Questions ==
33
+
34
+ = Which themes are supported by this plugin? =
35
+
36
+ 1. Beaver Builder Theme.
37
+ 2. Genesis Theme (and should work with most of its child themes).
38
+ 3. GeneratePress Theme.
39
+
40
+ == Changelog ==
41
+
42
+ = 1.0 =
43
+ * Initial Release.
themes/bb-theme/class-bb-theme-compat.php ADDED
@@ -0,0 +1,93 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * BB Theme Compatibility.
4
+ *
5
+ * @package header-footer-elementor
6
+ */
7
+
8
+ /**
9
+ * HFE_BB_Theme_Compat setup
10
+ *
11
+ * @since 1.0
12
+ */
13
+ class HFE_BB_Theme_Compat {
14
+
15
+ /**
16
+ * Instance of HFE_BB_Theme_Compat
17
+ *
18
+ * @var HFE_BB_Theme_Compat
19
+ */
20
+ private static $instance;
21
+
22
+ /**
23
+ * Initiator
24
+ */
25
+ public static function instance() {
26
+
27
+ if ( ! isset( self::$instance ) ) {
28
+ self::$instance = new HFE_BB_Theme_Compat();
29
+
30
+ self::$instance->hooks();
31
+ }
32
+
33
+ return self::$instance;
34
+ }
35
+
36
+ /**
37
+ * Run all the Actions / Filters.
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
+ }
53
+
54
+ }
55
+
56
+ /**
57
+ * Display header markup for beaver builder theme.
58
+ */
59
+ public function get_header_content() {
60
+
61
+ $header_layout = FLTheme::get_setting( 'fl-header-layout' );
62
+
63
+ if ( 'none' == $header_layout || is_page_template( 'tpl-no-header-footer.php' ) ) {
64
+ return;
65
+ }
66
+
67
+ ?>
68
+ <header id="masthead" itemscope="itemscope" itemtype="http://schema.org/WPHeader">
69
+ <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>
70
+ <?php Header_Footer_Elementor::get_header_content(); ?>
71
+ </header>
72
+ <?php
73
+ }
74
+
75
+ /**
76
+ * Display footer markup for beaver builder theme.
77
+ */
78
+ public function get_footer_content() {
79
+
80
+ if ( is_page_template( 'tpl-no-header-footer.php' ) ) {
81
+ return;
82
+ }
83
+
84
+ ?>
85
+ <footer itemscope="itemscope" itemtype="http://schema.org/WPFooter">
86
+ <?php Header_Footer_Elementor::get_footer_content(); ?>
87
+ </footer>
88
+ <?php
89
+ }
90
+
91
+ }
92
+
93
+ HFE_BB_Theme_Compat::instance();
themes/generatepress/generatepress-compat.php ADDED
@@ -0,0 +1,97 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * GeneratepressCompatibility.
4
+ *
5
+ * @package header-footer-elementor
6
+ */
7
+
8
+ /**
9
+ * HFE_GeneratePress_Compat setup
10
+ *
11
+ * @since 1.0
12
+ */
13
+ class HFE_GeneratePress_Compat {
14
+
15
+ /**
16
+ * Instance of HFE_GeneratePress_Compat
17
+ *
18
+ * @var HFE_GeneratePress_Compat
19
+ */
20
+ private static $instance;
21
+
22
+ /**
23
+ * Initiator
24
+ */
25
+ public static function instance() {
26
+
27
+ if ( ! isset( self::$instance ) ) {
28
+ self::$instance = new HFE_GeneratePress_Compat();
29
+
30
+ self::$instance->hooks();
31
+ }
32
+
33
+ return self::$instance;
34
+ }
35
+
36
+ /**
37
+ * Run all the Actions / Filters.
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
+ }
55
+
56
+ /**
57
+ * Disable header from the theme.
58
+ */
59
+ public function generatepress_setup_header() {
60
+ remove_action( 'generate_header', 'generate_construct_header' );
61
+ }
62
+
63
+ /**
64
+ * Disable footer from the theme.
65
+ */
66
+ public function generatepress_setup_footer() {
67
+ remove_action( 'generate_footer', 'generate_construct_footer_widgets', 5 );
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' ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></p>
79
+ <?php Header_Footer_Elementor::get_header_content(); ?>
80
+ </header>
81
+ <?php
82
+ }
83
+
84
+ /**
85
+ * Display footer markup for generatepress theme.
86
+ */
87
+ public function get_footer_content() {
88
+ ?>
89
+ <footer class="ehf-site-info" itemtype="http://schema.org/WPFooter" itemscope="itemscope">
90
+ <?php Header_Footer_Elementor::get_footer_content(); ?>
91
+ </footer>
92
+ <?php
93
+ }
94
+
95
+ }
96
+
97
+ HFE_GeneratePress_Compat::instance();
themes/genesis/class-genesis-compat.php ADDED
@@ -0,0 +1,138 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Genesis_Compat setup
4
+ *
5
+ * @package header-footer-elementor
6
+ */
7
+
8
+ /**
9
+ * Genesis theme compatibility.
10
+ */
11
+ class HFE_Genesis_Compat {
12
+
13
+ /**
14
+ * Instance of HFE_Genesis_Compat.
15
+ *
16
+ * @var HFE_Genesis_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_Genesis_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
+ $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 );
53
+ add_action( 'genesis_footer', array( 'Header_Footer_Elementor', 'get_footer_content' ), 16 );
54
+ }
55
+
56
+ }
57
+
58
+ /**
59
+ * Disable header from the theme.
60
+ */
61
+ public function genesis_setup_header() {
62
+
63
+ for ( $priority = 0; $priority < 16; $priority++ ) {
64
+ remove_all_actions( 'genesis_header', $priority );
65
+ }
66
+
67
+ }
68
+
69
+ /**
70
+ * Disable footer from the theme.
71
+ */
72
+ public function genesis_setup_footer() {
73
+
74
+ for ( $priority = 0; $priority < 16; $priority++ ) {
75
+ remove_all_actions( 'genesis_footer', $priority );
76
+ }
77
+
78
+ }
79
+
80
+ /**
81
+ * Open markup for header.
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
+
93
+ }
94
+
95
+ /**
96
+ * Close MArkup for header.
97
+ */
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
+
108
+ /**
109
+ * Open markup for footer.
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
+ }
121
+
122
+ /**
123
+ * Close markup for footer.
124
+ */
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
+
135
+
136
+ }
137
+
138
+ HFE_Genesis_Compat::instance();