WP init
This commit is contained in:
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
namespace ElementsKit_Lite\Modules\Header_Footer\Theme_Hooks;
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
/**
|
||||
* Astra theme compatibility.
|
||||
*/
|
||||
class Astra {
|
||||
|
||||
/**
|
||||
* Instance of Elementor Frontend class.
|
||||
*
|
||||
* @var \Elementor\Frontend()
|
||||
*/
|
||||
private $elementor;
|
||||
|
||||
private $header;
|
||||
private $footer;
|
||||
|
||||
/**
|
||||
* Run all the Actions / Filters.
|
||||
*/
|
||||
function __construct( $template_ids ) {
|
||||
$this->header = $template_ids[0];
|
||||
$this->footer = $template_ids[1];
|
||||
|
||||
if ( defined( 'ELEMENTOR_VERSION' ) && is_callable( 'Elementor\Plugin::instance' ) ) {
|
||||
$this->elementor = \Elementor\Plugin::instance();
|
||||
}
|
||||
|
||||
if ( $this->header != null ) {
|
||||
add_action( 'template_redirect', array( $this, 'remove_theme_header_markup' ), 10 );
|
||||
add_action( 'astra_header', array( $this, 'add_plugin_header_markup' ) );
|
||||
}
|
||||
|
||||
if ( $this->footer != null ) {
|
||||
add_action( 'template_redirect', array( $this, 'remove_theme_footer_markup' ), 10 );
|
||||
add_action( 'astra_footer', array( $this, 'add_plugin_footer_markup' ) );
|
||||
}
|
||||
}
|
||||
|
||||
// header actions
|
||||
public function remove_theme_header_markup() {
|
||||
remove_action( 'astra_header', 'astra_header_markup' );
|
||||
}
|
||||
|
||||
public function add_plugin_header_markup() {
|
||||
do_action( 'elementskit/template/before_header' );
|
||||
echo '<div class="ekit-template-content-markup ekit-template-content-header">';
|
||||
echo \ElementsKit_Lite\Utils::render_elementor_content( $this->header ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Displaying with Elementor content rendering
|
||||
echo '</div>';
|
||||
do_action( 'elementskit/template/after_header' );
|
||||
}
|
||||
|
||||
|
||||
// footer actions
|
||||
public function remove_theme_footer_markup() {
|
||||
remove_action( 'astra_footer', 'astra_footer_markup' );
|
||||
}
|
||||
|
||||
public function add_plugin_footer_markup() {
|
||||
do_action( 'elementskit/template/before_footer' );
|
||||
echo '<div class="ekit-template-content-markup ekit-template-content-footer">';
|
||||
echo \ElementsKit_Lite\Utils::render_elementor_content( $this->footer ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Displaying with Elementor content rendering
|
||||
echo '</div>';
|
||||
do_action( 'elementskit/template/after_footer' );
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
<?php
|
||||
namespace ElementsKit_Lite\Modules\Header_Footer\Theme_Hooks;
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
/**
|
||||
* BB theme theme compatibility.
|
||||
*/
|
||||
class Bbtheme {
|
||||
|
||||
/**
|
||||
* Instance of Elementor Frontend class.
|
||||
*
|
||||
* @var \Elementor\Frontend()
|
||||
*/
|
||||
private $elementor;
|
||||
|
||||
private $header;
|
||||
private $footer;
|
||||
|
||||
/**
|
||||
* Run all the Actions / Filters.
|
||||
*/
|
||||
function __construct( $template_ids ) {
|
||||
$this->header = $template_ids[0];
|
||||
$this->footer = $template_ids[1];
|
||||
|
||||
if ( defined( 'ELEMENTOR_VERSION' ) && is_callable( 'Elementor\Plugin::instance' ) ) {
|
||||
$this->elementor = \Elementor\Plugin::instance();
|
||||
}
|
||||
|
||||
if ( $this->header != null ) {
|
||||
add_filter( 'fl_header_enabled', '__return_false' );
|
||||
add_action( 'fl_before_header', array( $this, 'add_plugin_header_markup' ) );
|
||||
}
|
||||
|
||||
if ( $this->footer != null ) {
|
||||
add_filter( 'fl_footer_enabled', '__return_false' );
|
||||
add_action( 'fl_after_content', array( $this, 'add_plugin_footer_markup' ) );
|
||||
}
|
||||
}
|
||||
|
||||
// header actions
|
||||
public function add_plugin_header_markup() {
|
||||
|
||||
if ( class_exists( '\FLTheme' ) ) {
|
||||
$header_layout = \FLTheme::get_setting( 'fl-header-layout' );
|
||||
|
||||
if ( 'none' == $header_layout || is_page_template( 'tpl-no-header-footer.php' ) ) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
do_action( 'elementskit/template/before_header' );
|
||||
?>
|
||||
<header id="masthead" itemscope="itemscope" itemtype="https://schema.org/WPHeader">
|
||||
<div class="ekit-template-content-markup ekit-template-content-header">
|
||||
<?php
|
||||
echo \ElementsKit_Lite\Utils::render_elementor_content( $this->header ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Displaying with Elementor content rendering
|
||||
?>
|
||||
</div>
|
||||
</header>
|
||||
<style>
|
||||
[data-type="header"] {
|
||||
display: none !important;
|
||||
}
|
||||
</style>
|
||||
<?php
|
||||
do_action( 'elementskit/template/after_header' );
|
||||
}
|
||||
|
||||
|
||||
// footer actions
|
||||
public function add_plugin_footer_markup() {
|
||||
if ( is_page_template( 'tpl-no-header-footer.php' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
do_action( 'elementskit/template/before_footer' );
|
||||
?>
|
||||
|
||||
<footer itemscope="itemscope" itemtype="https://schema.org/WPFooter">
|
||||
<?php
|
||||
echo \ElementsKit_Lite\Utils::render_elementor_content( $this->footer ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Displaying with Elementor content rendering
|
||||
?>
|
||||
</footer>
|
||||
|
||||
<?php
|
||||
do_action( 'elementskit/template/after_footer' );
|
||||
}
|
||||
}
|
||||
+72
@@ -0,0 +1,72 @@
|
||||
<?php
|
||||
namespace ElementsKit_Lite\Modules\Header_Footer\Theme_Hooks;
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
/**
|
||||
* GeneratePress theme compatibility.
|
||||
*/
|
||||
class Generatepress {
|
||||
|
||||
/**
|
||||
* Instance of Elementor Frontend class.
|
||||
*
|
||||
* @var \Elementor\Frontend()
|
||||
*/
|
||||
private $elementor;
|
||||
|
||||
private $header;
|
||||
private $footer;
|
||||
|
||||
/**
|
||||
* Run all the Actions / Filters.
|
||||
*/
|
||||
function __construct( $template_ids ) {
|
||||
$this->header = $template_ids[0];
|
||||
$this->footer = $template_ids[1];
|
||||
|
||||
if ( defined( 'ELEMENTOR_VERSION' ) && is_callable( 'Elementor\Plugin::instance' ) ) {
|
||||
$this->elementor = \Elementor\Plugin::instance();
|
||||
}
|
||||
|
||||
if ( $this->header != null ) {
|
||||
add_action( 'template_redirect', array( $this, 'remove_theme_header_markup' ), 10 );
|
||||
add_action( 'generate_header', array( $this, 'add_plugin_header_markup' ) );
|
||||
}
|
||||
|
||||
if ( $this->footer != null ) {
|
||||
add_action( 'template_redirect', array( $this, 'remove_theme_footer_markup' ), 10 );
|
||||
add_action( 'generate_footer', array( $this, 'add_plugin_footer_markup' ) );
|
||||
}
|
||||
}
|
||||
|
||||
// header actions
|
||||
public function remove_theme_header_markup() {
|
||||
remove_action( 'generate_header', 'generate_construct_header' );
|
||||
}
|
||||
|
||||
public function add_plugin_header_markup() {
|
||||
do_action( 'elementskit/template/before_header' );
|
||||
echo '<div class="ekit-template-content-markup ekit-template-content-header">';
|
||||
echo \ElementsKit_Lite\Utils::render_elementor_content( $this->header ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Displaying with Elementor content rendering
|
||||
echo '</div>';
|
||||
do_action( 'elementskit/template/after_header' );
|
||||
}
|
||||
|
||||
|
||||
// footer actions
|
||||
public function remove_theme_footer_markup() {
|
||||
remove_action( 'generate_footer', 'generate_construct_footer_widgets', 5 );
|
||||
remove_action( 'generate_footer', 'generate_construct_footer' );
|
||||
}
|
||||
|
||||
public function add_plugin_footer_markup() {
|
||||
do_action( 'elementskit/template/before_footer' );
|
||||
echo '<div class="ekit-template-content-markup ekit-template-content-footer">';
|
||||
echo \ElementsKit_Lite\Utils::render_elementor_content( $this->footer ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Displaying with Elementor content rendering
|
||||
echo '</div>';
|
||||
do_action( 'elementskit/template/after_footer' );
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,133 @@
|
||||
<?php
|
||||
namespace ElementsKit_Lite\Modules\Header_Footer\Theme_Hooks;
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
/**
|
||||
* Genesis theme compatibility.
|
||||
*/
|
||||
class Genesis {
|
||||
|
||||
/**
|
||||
* Instance of Elementor Frontend class.
|
||||
*
|
||||
* @var \Elementor\Frontend()
|
||||
*/
|
||||
private $elementor;
|
||||
|
||||
private $header;
|
||||
private $footer;
|
||||
|
||||
/**
|
||||
* Run all the Actions / Filters.
|
||||
*/
|
||||
function __construct( $template_ids ) {
|
||||
$this->header = $template_ids[0];
|
||||
$this->footer = $template_ids[1];
|
||||
|
||||
if ( defined( 'ELEMENTOR_VERSION' ) && is_callable( 'Elementor\Plugin::instance' ) ) {
|
||||
$this->elementor = \Elementor\Plugin::instance();
|
||||
}
|
||||
|
||||
if ( $this->header != null ) {
|
||||
add_action( 'template_redirect', array( $this, 'remove_theme_header_markup' ), 10 );
|
||||
add_action( 'ocean_header', array( $this, 'add_plugin_header_markup' ) );
|
||||
add_action( 'genesis_header', array( $this, 'genesis_header_markup_open' ), 16 );
|
||||
add_action( 'genesis_header', array( $this, 'genesis_header_markup_close' ), 25 ); }
|
||||
|
||||
if ( $this->footer != null ) {
|
||||
add_action( 'template_redirect', array( $this, 'remove_theme_footer_markup' ), 10 );
|
||||
add_action( 'genesis_footer', array( $this, 'genesis_footer_markup_open' ), 16 );
|
||||
add_action( 'genesis_footer', array( $this, 'genesis_footer_markup_close' ), 25 );
|
||||
add_action( 'ocean_footer', array( $this, 'add_plugin_footer_markup' ) );
|
||||
}
|
||||
}
|
||||
|
||||
// header actions
|
||||
public function remove_theme_header_markup() {
|
||||
for ( $priority = 0; $priority < 16; $priority ++ ) {
|
||||
remove_all_actions( 'genesis_header', $priority );
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Open markup for header.
|
||||
*/
|
||||
public function genesis_header_markup_open() {
|
||||
|
||||
genesis_markup(
|
||||
array(
|
||||
'html5' => '<header %s>',
|
||||
'xhtml' => '<div id="header">',
|
||||
'context' => 'site-header',
|
||||
)
|
||||
);
|
||||
|
||||
genesis_structural_wrap( 'header' );
|
||||
}
|
||||
/**
|
||||
* Close MArkup for header.
|
||||
*/
|
||||
public function genesis_header_markup_close() {
|
||||
|
||||
genesis_structural_wrap( 'header', 'close' );
|
||||
genesis_markup(
|
||||
array(
|
||||
'html5' => '</header>',
|
||||
'xhtml' => '</div>',
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
public function add_plugin_header_markup() {
|
||||
do_action( 'elementskit/template/before_header' );
|
||||
echo '<div class="ekit-template-content-markup ekit-template-content-header">';
|
||||
echo \ElementsKit_Lite\Utils::render_elementor_content( $this->header ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Displaying with Elementor content rendering
|
||||
echo '</div>';
|
||||
do_action( 'elementskit/template/after_header' );
|
||||
}
|
||||
|
||||
|
||||
// footer actions
|
||||
public function remove_theme_footer_markup() {
|
||||
for ( $priority = 0; $priority < 16; $priority ++ ) {
|
||||
remove_all_actions( 'genesis_footer', $priority );
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Open markup for footer.
|
||||
*/
|
||||
public function genesis_footer_markup_open() {
|
||||
|
||||
genesis_markup(
|
||||
array(
|
||||
'html5' => '<footer %s>',
|
||||
'xhtml' => '<div id="footer" class="footer">',
|
||||
'context' => 'site-footer',
|
||||
)
|
||||
);
|
||||
genesis_structural_wrap( 'footer', 'open' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Close markup for footer.
|
||||
*/
|
||||
public function genesis_footer_markup_close() {
|
||||
|
||||
genesis_structural_wrap( 'footer', 'close' );
|
||||
genesis_markup(
|
||||
array(
|
||||
'html5' => '</footer>',
|
||||
'xhtml' => '</div>',
|
||||
)
|
||||
);
|
||||
}
|
||||
public function add_plugin_footer_markup() {
|
||||
do_action( 'elementskit/template/before_footer' );
|
||||
echo '<div class="ekit-template-content-markup ekit-template-content-footer">';
|
||||
echo \ElementsKit_Lite\Utils::render_elementor_content( $this->footer ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Displaying with Elementor content rendering
|
||||
echo '</div>';
|
||||
do_action( 'elementskit/template/after_footer' );
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+45
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
if ( ! function_exists( 'hfe_render_header' ) ) {
|
||||
function hfe_render_header() {
|
||||
global $elementskit_template_ids;
|
||||
if ( $elementskit_template_ids[0] == null ) {
|
||||
return;
|
||||
}
|
||||
|
||||
do_action( 'elementskit/template/before_header' );
|
||||
echo '<div class="ekit-template-content-markup ekit-template-content-header">';
|
||||
echo \ElementsKit_Lite\Utils::render_elementor_content( $elementskit_template_ids[0] ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Displaying with Elementor content rendering
|
||||
echo '</div>';
|
||||
do_action( 'elementskit/template/after_header' );
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'get_hfe_header_id' ) ) {
|
||||
function get_hfe_header_id() {
|
||||
global $elementskit_template_ids;
|
||||
return $elementskit_template_ids[0];
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'hfe_render_footer' ) ) {
|
||||
function hfe_render_footer() {
|
||||
global $elementskit_template_ids;
|
||||
if ( $elementskit_template_ids[1] == null ) {
|
||||
return;
|
||||
}
|
||||
|
||||
do_action( 'elementskit/template/before_header' );
|
||||
echo '<div class="ekit-template-content-markup ekit-template-content-header">';
|
||||
echo \ElementsKit_Lite\Utils::render_elementor_content( $elementskit_template_ids[1] ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Displaying with Elementor content rendering
|
||||
echo '</div>';
|
||||
do_action( 'elementskit/template/after_header' );
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'get_hfe_footer_id' ) ) {
|
||||
function get_hfe_footer_id() {
|
||||
global $elementskit_template_ids;
|
||||
return $elementskit_template_ids[1];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
namespace ElementsKit_Lite\Modules\Header_Footer\Theme_Hooks;
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
/**
|
||||
* MyListing support for the header footer.
|
||||
*/
|
||||
class MyListing {
|
||||
|
||||
|
||||
/**
|
||||
* Run all the Actions / Filters.
|
||||
*/
|
||||
function __construct( $template_ids ) {
|
||||
global $elementskit_template_ids;
|
||||
|
||||
$elementskit_template_ids = $template_ids;
|
||||
include 'my-listing-functions.php';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
namespace ElementsKit_Lite\Modules\Header_Footer\Theme_Hooks;
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
/**
|
||||
* Neve theme compatibility.
|
||||
*/
|
||||
class Neve {
|
||||
|
||||
/**
|
||||
* Instance of Elementor Frontend class.
|
||||
*
|
||||
* @var \Elementor\Frontend()
|
||||
*/
|
||||
private $elementor;
|
||||
|
||||
private $header;
|
||||
private $footer;
|
||||
|
||||
/**
|
||||
* Run all the Actions / Filters.
|
||||
*/
|
||||
function __construct( $template_ids ) {
|
||||
$this->header = $template_ids[0];
|
||||
$this->footer = $template_ids[1];
|
||||
|
||||
if ( defined( 'ELEMENTOR_VERSION' ) && is_callable( 'Elementor\Plugin::instance' ) ) {
|
||||
$this->elementor = \Elementor\Plugin::instance();
|
||||
}
|
||||
|
||||
if ( $this->header != null ) {
|
||||
add_action( 'template_redirect', array( $this, 'remove_theme_header_markup' ), 10 );
|
||||
add_action( 'neve_do_header', array( $this, 'add_plugin_header_markup' ) );
|
||||
}
|
||||
|
||||
if ( $this->footer != null ) {
|
||||
add_action( 'template_redirect', array( $this, 'remove_theme_footer_markup' ), 10 );
|
||||
add_action( 'neve_do_footer', array( $this, 'add_plugin_footer_markup' ) );
|
||||
}
|
||||
}
|
||||
|
||||
// header actions
|
||||
public function remove_theme_header_markup() {
|
||||
remove_all_actions( 'hfg_header_render' );
|
||||
}
|
||||
|
||||
public function add_plugin_header_markup() {
|
||||
do_action( 'elementskit/template/before_header' );
|
||||
echo '<div class="ekit-template-content-markup ekit-template-content-header">';
|
||||
echo \ElementsKit_Lite\Utils::render_elementor_content( $this->header ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Displaying with Elementor content rendering
|
||||
echo '</div>';
|
||||
do_action( 'elementskit/template/after_header' );
|
||||
}
|
||||
|
||||
// footer actions
|
||||
public function remove_theme_footer_markup() {
|
||||
remove_all_actions( 'hfg_footer_render' );
|
||||
}
|
||||
|
||||
public function add_plugin_footer_markup() {
|
||||
do_action( 'elementskit/template/before_footer' );
|
||||
echo '<div class="ekit-template-content-markup ekit-template-content-footer">';
|
||||
echo \ElementsKit_Lite\Utils::render_elementor_content( $this->footer ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Displaying with Elementor content rendering
|
||||
echo '</div>';
|
||||
do_action( 'elementskit/template/after_footer' );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
<?php
|
||||
namespace ElementsKit_Lite\Modules\Header_Footer\Theme_Hooks;
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
/**
|
||||
* Oceanwp theme compatibility.
|
||||
*/
|
||||
class Oceanwp {
|
||||
|
||||
/**
|
||||
* Instance of Elementor Frontend class.
|
||||
*
|
||||
* @var \Elementor\Frontend()
|
||||
*/
|
||||
private $elementor;
|
||||
|
||||
private $header;
|
||||
private $footer;
|
||||
|
||||
/**
|
||||
* Run all the Actions / Filters.
|
||||
*/
|
||||
function __construct( $template_ids ) {
|
||||
$this->header = $template_ids[0];
|
||||
$this->footer = $template_ids[1];
|
||||
|
||||
if ( defined( 'ELEMENTOR_VERSION' ) && is_callable( 'Elementor\Plugin::instance' ) ) {
|
||||
$this->elementor = \Elementor\Plugin::instance();
|
||||
}
|
||||
|
||||
if ( $this->header != null ) {
|
||||
add_action( 'template_redirect', array( $this, 'remove_theme_header_markup' ), 10 );
|
||||
add_action( 'ocean_header', array( $this, 'add_plugin_header_markup' ) );
|
||||
}
|
||||
|
||||
if ( $this->footer != null ) {
|
||||
add_action( 'template_redirect', array( $this, 'remove_theme_footer_markup' ), 10 );
|
||||
add_action( 'ocean_footer', array( $this, 'add_plugin_footer_markup' ) );
|
||||
}
|
||||
}
|
||||
|
||||
// header actions
|
||||
public function remove_theme_header_markup() {
|
||||
remove_action( 'ocean_top_bar', 'oceanwp_top_bar_template' );
|
||||
remove_action( 'ocean_header', 'oceanwp_header_template' );
|
||||
remove_action( 'ocean_page_header', 'oceanwp_page_header_template' );
|
||||
}
|
||||
|
||||
public function add_plugin_header_markup() {
|
||||
do_action( 'elementskit/template/before_header' );
|
||||
echo '<div class="ekit-template-content-markup ekit-template-content-header">';
|
||||
echo \ElementsKit_Lite\Utils::render_elementor_content( $this->header ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Displaying with Elementor content rendering
|
||||
echo '</div>';
|
||||
do_action( 'elementskit/template/after_header' );
|
||||
}
|
||||
|
||||
|
||||
// footer actions
|
||||
public function remove_theme_footer_markup() {
|
||||
remove_action( 'ocean_footer', 'oceanwp_footer_template' );
|
||||
}
|
||||
|
||||
public function add_plugin_footer_markup() {
|
||||
do_action( 'elementskit/template/before_footer' );
|
||||
echo '<div class="ekit-template-content-markup ekit-template-content-footer">';
|
||||
echo \ElementsKit_Lite\Utils::render_elementor_content( $this->footer ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Displaying with Elementor content rendering
|
||||
echo '</div>';
|
||||
do_action( 'elementskit/template/after_footer' );
|
||||
}
|
||||
|
||||
}
|
||||
+61
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
namespace ElementsKit_Lite\Modules\Header_Footer\Theme_Hooks;
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
/**
|
||||
* Force fully replace the header footer.
|
||||
*/
|
||||
class Theme_Support {
|
||||
|
||||
|
||||
/**
|
||||
* Run all the Actions / Filters.
|
||||
*/
|
||||
function __construct( $template_ids ) {
|
||||
if ( $template_ids[0] != null ) {
|
||||
add_action( 'get_header', array( $this, 'get_header' ) );
|
||||
}
|
||||
if ( $template_ids[1] != null ) {
|
||||
add_action( 'get_footer', array( $this, 'get_footer' ) );
|
||||
}
|
||||
}
|
||||
|
||||
public function get_header( $name ) {
|
||||
require __DIR__ . '/../views/theme-support-header.php';
|
||||
|
||||
$templates = array();
|
||||
$name = (string) $name;
|
||||
if ( '' !== $name ) {
|
||||
$templates[] = "header-{$name}.php";
|
||||
}
|
||||
|
||||
$templates[] = 'header.php';
|
||||
|
||||
// Avoid running wp_head hooks again
|
||||
remove_all_actions( 'wp_head' );
|
||||
ob_start();
|
||||
// It cause a `require_once` so, in the get_header it self it will not be required again.
|
||||
locate_template( $templates, true );
|
||||
ob_get_clean();
|
||||
}
|
||||
|
||||
public function get_footer( $name ) {
|
||||
require __DIR__ . '/../views/theme-support-footer.php';
|
||||
|
||||
$templates = array();
|
||||
$name = (string) $name;
|
||||
if ( '' !== $name ) {
|
||||
$templates[] = "footer-{$name}.php";
|
||||
}
|
||||
|
||||
$templates[] = 'footer.php';
|
||||
|
||||
ob_start();
|
||||
// It cause a `require_once` so, in the get_header it self it will not be required again.
|
||||
locate_template( $templates, true );
|
||||
ob_get_clean();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+75
@@ -0,0 +1,75 @@
|
||||
<?php
|
||||
namespace ElementsKit_Lite\Modules\Header_Footer\Theme_Hooks;
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
/**
|
||||
* TwentyNineteen support for the header footer.
|
||||
*/
|
||||
class TwentyNineteen {
|
||||
|
||||
|
||||
/**
|
||||
* Run all the Actions / Filters.
|
||||
*/
|
||||
function __construct( $template_ids ) {
|
||||
if ( $template_ids[0] != null ) {
|
||||
add_action( 'get_header', array( $this, 'get_header' ) );
|
||||
}
|
||||
if ( $template_ids[1] != null ) {
|
||||
add_action( 'get_footer', array( $this, 'get_footer' ) );
|
||||
}
|
||||
}
|
||||
|
||||
public function get_header( $name ) {
|
||||
add_action(
|
||||
'elementskit/template/after_header',
|
||||
function() {
|
||||
echo '<div id="page" class="site">';
|
||||
echo '<div id="content" class="site-content">';
|
||||
}
|
||||
);
|
||||
require __DIR__ . '/../views/theme-support-header.php';
|
||||
|
||||
$templates = array();
|
||||
$name = (string) $name;
|
||||
if ( '' !== $name ) {
|
||||
$templates[] = "header-{$name}.php";
|
||||
}
|
||||
|
||||
$templates[] = 'header.php';
|
||||
|
||||
// Avoid running wp_head hooks again
|
||||
remove_all_actions( 'wp_head' );
|
||||
ob_start();
|
||||
// It cause a `require_once` so, in the get_header it self it will not be required again.
|
||||
locate_template( $templates, true );
|
||||
ob_get_clean();
|
||||
}
|
||||
|
||||
public function get_footer( $name ) {
|
||||
add_action(
|
||||
'elementskit/template/after_footer',
|
||||
function() {
|
||||
echo '</div></div>';
|
||||
}
|
||||
);
|
||||
|
||||
require __DIR__ . '/../views/theme-support-footer.php';
|
||||
|
||||
$templates = array();
|
||||
$name = (string) $name;
|
||||
if ( '' !== $name ) {
|
||||
$templates[] = "footer-{$name}.php";
|
||||
}
|
||||
|
||||
$templates[] = 'footer.php';
|
||||
|
||||
ob_start();
|
||||
// It cause a `require_once` so, in the get_header it self it will not be required again.
|
||||
locate_template( $templates, true );
|
||||
ob_get_clean();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user