Advertisement
fauzanjeg

JKIT || Fix MetForm issue in Header/Footer Template

Dec 16th, 2022
1,521
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.83 KB | None | 0 0
  1. /** START || Fix MetForm issue in Header/Footer Template */
  2. function remove_jkit_header_footer_default_filter() {
  3.     remove_action( 'jkit_header', array( Jeg\Elementor_Kit\Templates\Template::instance(), 'render_header' ) );
  4.     remove_action( 'jkit_footer', array( Jeg\Elementor_Kit\Templates\Template::instance(), 'render_footer' ) );
  5. }
  6. add_action( 'wp', 'remove_jkit_header_footer_default_filter' );
  7.  
  8. function add_custom_jkit_header_template() {
  9.     $class_template = Jeg\Elementor_Kit\Templates\Template::instance();
  10.     $post_id        = get_the_ID();
  11.     $headers        = $class_template->get_header_template();
  12.     $header_id      = null;
  13.  
  14.     foreach ( $headers as $header ) {
  15.         $flag = $class_template->check_conditions( $post_id, $header['id'] );
  16.  
  17.         if ( $flag ) {
  18.             $header_id = $header['id'];
  19.             break;
  20.         }
  21.     }
  22.  
  23.     if ( $header_id ) {
  24.         ?>
  25.             <header id="masthead" itemscope="itemscope" itemtype="https://schema.org/WPHeader">
  26.                 <?php
  27.                 echo $class_template->get_header_content( $header_id );
  28.                 ?>
  29.             </header>
  30.         <?php
  31.     }
  32. }
  33. add_action( 'jkit_header', 'add_custom_jkit_header_template' );
  34.  
  35. function add_custom_jkit_footer_template() {
  36.     $class_template = Jeg\Elementor_Kit\Templates\Template::instance();
  37.     $post_id        = get_the_ID();
  38.     $footers        = $class_template->get_footer_template();
  39.     $footer_id      = null;
  40.  
  41.     foreach ( $footers as $footer ) {
  42.         $flag = $class_template->check_conditions( $post_id, $footer['id'] );
  43.  
  44.         if ( $flag ) {
  45.             $footer_id = $footer['id'];
  46.             break;
  47.         }
  48.     }
  49.  
  50.     if ( $footer_id ) {
  51.         ?>
  52.             <footer itemscope="itemscope" itemtype="https://schema.org/WPFooter">
  53.                 <?php
  54.                 echo $class_template->get_footer_content( $footer_id );
  55.                 ?>
  56.             </footer>
  57.         <?php
  58.     }
  59. }
  60. add_action( 'jkit_footer', 'add_custom_jkit_footer_template' );
  61. /** END || Fix MetForm issue in Header/Footer Template */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement