-
Notifications
You must be signed in to change notification settings - Fork 1
/
genesis-elementor-canvas.php
150 lines (118 loc) · 3.63 KB
/
genesis-elementor-canvas.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
<?php # -*- coding: utf-8 -*-
/**
* Main plugin file.
* @package Genesis Elementor Canvas
* @author David Decker
* @copyright Copyright (c) 2018, David Decker - DECKERWEB
* @license GPL-2.0+
* @link https://deckerweb.de/twitter
*
* @wordpress-plugin
* Plugin Name: Genesis Elementor Canvas
* Plugin URI: https://github.com/deckerweb/genesis-elementor-canvas
* Description: Optimizations for Elementor Canvas page template when used with Genesis.
* Version: 2018.02.26.2
* Author: David Decker - DECKERWEB
* Author URI: https://deckerweb.de/
* License: GPL-2.0+
* License URI: http://www.opensource.org/licenses/gpl-license.php
* Text Domain: genesis-elementor-canvas
* Domain Path: /languages/
* GitHub Plugin URI: https://github.com/deckerweb/genesis-elementor-canvas
* GitHub Branch: master
* Requires WP: 4.5
* Requires PHP: 5.4
*
* Copyright (c) 2018 David Decker - DECKERWEB
*/
/**
* Exit if called directly.
*/
if ( ! defined( 'WPINC' ) ) {
die;
}
/**
* Installs dependency "GitHup Updater" to manage future updates of this plugin.
*
* @version 1.3.2
* @since 2018.02.26
*/
require_once( 'includes/dependencies/wp-dependency-installer.php' );
WP_Dependency_Installer::instance()->run( dirname( __FILE__ ) . '/includes/dependencies' );
add_action( 'init', 'ddw_gec_load_translations', 1 );
/**
* Load the text domain for translation of the plugin.
*
* @since 2018.02.23
*
* @uses load_plugin_textdomain() To additionally load default translations
* from plugin folder (default).
*/
function ddw_gec_load_translations() {
/** Translations: Secondly, look in plugin's "languages" folder = default */
load_plugin_textdomain(
'genesis-elementor-canvas',
FALSE,
trailingslashit( dirname( plugin_basename( __FILE__ ) ) ) . 'languages'
);
} // end function
add_filter( 'body_class', 'ddw_gec_genesis_canvas_body_class' );
/**
* Adds a css class to the body element
*
* @param array $classes the current body classes
* @return array $classes modified classes
*/
function ddw_gec_genesis_canvas_body_class( $classes ) {
if ( ! is_page_template( 'elementor_canvas' ) ) {
return;
}
$classes[] = 'genesis-canvas';
return $classes;
} // end function
add_action( 'wp_head', 'ddw_gec_add_genesis_meta', 0 );
/**
* Add Genesis Action 'genesis_meta' within document header.
*
* @since 2018.02.23
*/
function ddw_gec_add_genesis_meta() {
if ( ! is_page_template( 'elementor_canvas' ) ) {
return;
}
do_action( 'genesis_meta' );
} // end function
add_action( 'elementor/page_templates/canvas/before_content', 'ddw_gec_add_genesis_before', -1 );
/**
* Add Genesis Action 'genesis_before' within document body.
*
* @since 2018.02.23
*/
function ddw_gec_add_genesis_before() {
if ( ! is_page_template( 'elementor_canvas' ) ) {
return;
}
do_action( 'genesis_before' );
} // end function
add_action( 'elementor/page_templates/canvas/after_content', 'ddw_gec_add_genesis_after', -1 );
/**
* Add Genesis Action 'genesis_after' within document body.
*
* @since 2018.02.23
*/
function ddw_gec_add_genesis_after() {
if ( ! is_page_template( 'elementor_canvas' ) ) {
return;
}
do_action( 'genesis_after' );
} // end function
add_action( 'wp_head', 'ddw_gec_remove_double_viewport', -1 );
/**
* Remove the doubled Viewport meta tag added by Genesis.
*/
function ddw_gec_remove_double_viewport() {
if ( ! is_page_template( 'elementor_canvas' ) ) {
return;
}
remove_action( 'genesis_meta', 'genesis_responsive_viewport' );
} // end function