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
generatepress.php
73 lines
| 1 | <?php |
| 2 | namespace ElementsKit_Lite\Modules\Header_Footer\Theme_Hooks; |
| 3 | |
| 4 | defined( 'ABSPATH' ) || exit; |
| 5 | |
| 6 | /** |
| 7 | * GeneratePress theme compatibility. |
| 8 | */ |
| 9 | class Generatepress { |
| 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( 'generate_header', array( $this, 'add_plugin_header_markup' ) ); |
| 35 | } |
| 36 | |
| 37 | if ( $this->footer != null ) { |
| 38 | add_action( 'template_redirect', array( $this, 'remove_theme_footer_markup' ), 10 ); |
| 39 | add_action( 'generate_footer', array( $this, 'add_plugin_footer_markup' ) ); |
| 40 | } |
| 41 | } |
| 42 | |
| 43 | // header actions |
| 44 | public function remove_theme_header_markup() { |
| 45 | remove_action( 'generate_header', 'generate_construct_header' ); |
| 46 | } |
| 47 | |
| 48 | public function add_plugin_header_markup() { |
| 49 | do_action( 'elementskit/template/before_header' ); |
| 50 | echo '<div class="ekit-template-content-markup ekit-template-content-header">'; |
| 51 | echo \ElementsKit_Lite\Utils::render_elementor_content( $this->header ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Displaying with Elementor content rendering |
| 52 | echo '</div>'; |
| 53 | do_action( 'elementskit/template/after_header' ); |
| 54 | } |
| 55 | |
| 56 | |
| 57 | // footer actions |
| 58 | public function remove_theme_footer_markup() { |
| 59 | remove_action( 'generate_footer', 'generate_construct_footer_widgets', 5 ); |
| 60 | remove_action( 'generate_footer', 'generate_construct_footer' ); |
| 61 | } |
| 62 | |
| 63 | public function add_plugin_footer_markup() { |
| 64 | do_action( 'elementskit/template/before_footer' ); |
| 65 | echo '<div class="ekit-template-content-markup ekit-template-content-footer">'; |
| 66 | echo \ElementsKit_Lite\Utils::render_elementor_content( $this->footer ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Displaying with Elementor content rendering |
| 67 | echo '</div>'; |
| 68 | do_action( 'elementskit/template/after_footer' ); |
| 69 | } |
| 70 | |
| 71 | |
| 72 | } |
| 73 |