astra.php
4 years ago
bbtheme.php
4 years ago
generatepress.php
4 years ago
genesis.php
4 years ago
my-listing-functions.php
4 years ago
my-listing.php
4 years ago
neve.php
4 years ago
oceanwp.php
4 years ago
theme-support.php
4 years ago
twenty-nineteen.php
4 years ago
genesis.php
134 lines
| 1 | <?php |
| 2 | namespace ElementsKit_Lite\Modules\Header_Footer\Theme_Hooks; |
| 3 | |
| 4 | defined( 'ABSPATH' ) || exit; |
| 5 | |
| 6 | /** |
| 7 | * Genesis theme compatibility. |
| 8 | */ |
| 9 | class Genesis { |
| 10 | |
| 11 | /** |
| 12 | * Instance of Elementor Frontend class. |
| 13 | * |
| 14 | * @var \Elementor\Frontend() |
| 15 | */ |
| 16 | private $elementor; |
| 17 | |
| 18 | private $header; |
| 19 | private $footer; |
| 20 | |
| 21 | /** |
| 22 | * Run all the Actions / Filters. |
| 23 | */ |
| 24 | function __construct( $template_ids ) { |
| 25 | $this->header = $template_ids[0]; |
| 26 | $this->footer = $template_ids[1]; |
| 27 | |
| 28 | if ( defined( 'ELEMENTOR_VERSION' ) && is_callable( 'Elementor\Plugin::instance' ) ) { |
| 29 | $this->elementor = \Elementor\Plugin::instance(); |
| 30 | } |
| 31 | |
| 32 | if ( $this->header != null ) { |
| 33 | add_action( 'template_redirect', array( $this, 'remove_theme_header_markup' ), 10 ); |
| 34 | add_action( 'ocean_header', array( $this, 'add_plugin_header_markup' ) ); |
| 35 | add_action( 'genesis_header', array( $this, 'genesis_header_markup_open' ), 16 ); |
| 36 | add_action( 'genesis_header', array( $this, 'genesis_header_markup_close' ), 25 ); } |
| 37 | |
| 38 | if ( $this->footer != null ) { |
| 39 | add_action( 'template_redirect', array( $this, 'remove_theme_footer_markup' ), 10 ); |
| 40 | add_action( 'genesis_footer', array( $this, 'genesis_footer_markup_open' ), 16 ); |
| 41 | add_action( 'genesis_footer', array( $this, 'genesis_footer_markup_close' ), 25 ); |
| 42 | add_action( 'ocean_footer', array( $this, 'add_plugin_footer_markup' ) ); |
| 43 | } |
| 44 | } |
| 45 | |
| 46 | // header actions |
| 47 | public function remove_theme_header_markup() { |
| 48 | for ( $priority = 0; $priority < 16; $priority ++ ) { |
| 49 | remove_all_actions( 'genesis_header', $priority ); |
| 50 | } |
| 51 | } |
| 52 | /** |
| 53 | * Open markup for header. |
| 54 | */ |
| 55 | public function genesis_header_markup_open() { |
| 56 | |
| 57 | genesis_markup( |
| 58 | array( |
| 59 | 'html5' => '<header %s>', |
| 60 | 'xhtml' => '<div id="header">', |
| 61 | 'context' => 'site-header', |
| 62 | ) |
| 63 | ); |
| 64 | |
| 65 | genesis_structural_wrap( 'header' ); |
| 66 | } |
| 67 | /** |
| 68 | * Close MArkup for header. |
| 69 | */ |
| 70 | public function genesis_header_markup_close() { |
| 71 | |
| 72 | genesis_structural_wrap( 'header', 'close' ); |
| 73 | genesis_markup( |
| 74 | array( |
| 75 | 'html5' => '</header>', |
| 76 | 'xhtml' => '</div>', |
| 77 | ) |
| 78 | ); |
| 79 | } |
| 80 | |
| 81 | public function add_plugin_header_markup() { |
| 82 | do_action( 'elementskit/template/before_header' ); |
| 83 | echo '<div class="ekit-template-content-markup ekit-template-content-header">'; |
| 84 | echo \ElementsKit_Lite\Utils::render_elementor_content( $this->header ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Displaying with Elementor content rendering |
| 85 | echo '</div>'; |
| 86 | do_action( 'elementskit/template/after_header' ); |
| 87 | } |
| 88 | |
| 89 | |
| 90 | // footer actions |
| 91 | public function remove_theme_footer_markup() { |
| 92 | for ( $priority = 0; $priority < 16; $priority ++ ) { |
| 93 | remove_all_actions( 'genesis_footer', $priority ); |
| 94 | } |
| 95 | } |
| 96 | /** |
| 97 | * Open markup for footer. |
| 98 | */ |
| 99 | public function genesis_footer_markup_open() { |
| 100 | |
| 101 | genesis_markup( |
| 102 | array( |
| 103 | 'html5' => '<footer %s>', |
| 104 | 'xhtml' => '<div id="footer" class="footer">', |
| 105 | 'context' => 'site-footer', |
| 106 | ) |
| 107 | ); |
| 108 | genesis_structural_wrap( 'footer', 'open' ); |
| 109 | } |
| 110 | |
| 111 | /** |
| 112 | * Close markup for footer. |
| 113 | */ |
| 114 | public function genesis_footer_markup_close() { |
| 115 | |
| 116 | genesis_structural_wrap( 'footer', 'close' ); |
| 117 | genesis_markup( |
| 118 | array( |
| 119 | 'html5' => '</footer>', |
| 120 | 'xhtml' => '</div>', |
| 121 | ) |
| 122 | ); |
| 123 | } |
| 124 | public function add_plugin_footer_markup() { |
| 125 | do_action( 'elementskit/template/before_footer' ); |
| 126 | echo '<div class="ekit-template-content-markup ekit-template-content-footer">'; |
| 127 | echo \ElementsKit_Lite\Utils::render_elementor_content( $this->footer ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Displaying with Elementor content rendering |
| 128 | echo '</div>'; |
| 129 | do_action( 'elementskit/template/after_footer' ); |
| 130 | } |
| 131 | |
| 132 | |
| 133 | } |
| 134 |