class-hfe-astra-compat.php
68 lines
| 1 | <?php |
| 2 | /** |
| 3 | * HFE_Astra_Compat setup |
| 4 | * |
| 5 | * @package header-footer-elementor |
| 6 | */ |
| 7 | |
| 8 | /** |
| 9 | * Astra theme compatibility. |
| 10 | */ |
| 11 | class HFE_Astra_Compat { |
| 12 | |
| 13 | /** |
| 14 | * Instance of HFE_Astra_Compat. |
| 15 | * |
| 16 | * @var HFE_Astra_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_Astra_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, '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 | } |
| 50 | |
| 51 | /** |
| 52 | * Disable header from the theme. |
| 53 | */ |
| 54 | public function astra_setup_header() { |
| 55 | remove_action( 'astra_header', 'astra_header_markup' ); |
| 56 | } |
| 57 | |
| 58 | /** |
| 59 | * Disable footer from the theme. |
| 60 | */ |
| 61 | public function astra_setup_footer() { |
| 62 | remove_action( 'astra_footer', 'astra_footer_markup' ); |
| 63 | } |
| 64 | |
| 65 | } |
| 66 | |
| 67 | HFE_Astra_Compat::instance(); |
| 68 |