singular-canvas.php
1 year ago
singular-fullwidth.php
1 year ago
theme-footer.php
1 year ago
theme-header.php
1 year ago
theme-template.php
1 year ago
theme-template.php
56 lines
| 1 | <?php |
| 2 | defined('ABSPATH') || exit; |
| 3 | |
| 4 | class Ecafe_Theme_Template { |
| 5 | |
| 6 | function __construct() { |
| 7 | |
| 8 | $headers = Ecafe_Condition_Rules::get_instance()->ec_get_location_type('header'); |
| 9 | $footers = Ecafe_Condition_Rules::get_instance()->ec_get_location_type('footer'); |
| 10 | |
| 11 | if (!empty($headers)) { |
| 12 | add_action('get_header', [$this, 'get_header_render']); |
| 13 | } |
| 14 | if (!empty($footers)) { |
| 15 | add_action('get_footer', [$this, 'get_footer_render']); |
| 16 | } |
| 17 | } |
| 18 | |
| 19 | public function get_header_render($temp_name) { |
| 20 | |
| 21 | require( ECAFE_CLASSES_URL . 'builders/theme-header.php' ); |
| 22 | |
| 23 | $temp_name = (string) $temp_name; |
| 24 | $load_templates = []; |
| 25 | if ($temp_name !== ''){ |
| 26 | $load_templates[] = "header-{$temp_name}.php"; |
| 27 | } |
| 28 | |
| 29 | $load_templates[] = 'header.php'; |
| 30 | |
| 31 | remove_all_actions('wp_head'); |
| 32 | ob_start(); |
| 33 | |
| 34 | locate_template($load_templates, true); |
| 35 | ob_get_clean(); |
| 36 | } |
| 37 | |
| 38 | public function get_footer_render($temp_name) { |
| 39 | |
| 40 | require( ECAFE_CLASSES_URL . 'builders/theme-footer.php' ); |
| 41 | $temp_name = (string) $temp_name; |
| 42 | $load_templates = []; |
| 43 | if($temp_name !== ''){ |
| 44 | $load_templates[] = "footer-{$temp_name}.php"; |
| 45 | } |
| 46 | |
| 47 | $load_templates[] = 'footer.php'; |
| 48 | |
| 49 | ob_start(); |
| 50 | |
| 51 | locate_template($load_templates, true); |
| 52 | ob_get_clean(); |
| 53 | } |
| 54 | |
| 55 | } |
| 56 |