| 1 |
<?php |
| 2 |
defined( 'ABSPATH' ) || exit; |
| 3 |
|
| 4 |
$header_id = ultimate_post()->conditions('header'); |
| 5 |
$footer_id = ultimate_post()->conditions('footer'); |
| 6 |
|
| 7 |
if ( wp_is_block_theme() ) { |
| 8 |
?><!DOCTYPE html> |
| 9 |
<html <?php language_attributes(); ?>> |
| 10 |
<head> |
| 11 |
<meta charset="<?php bloginfo( 'charset' ); ?>" /> |
| 12 |
<?php |
| 13 |
wp_head(); |
| 14 |
?> |
| 15 |
</head> |
| 16 |
<body <?php body_class(); ?>> |
| 17 |
<?php wp_body_open(); |
| 18 |
|
| 19 |
if( !$header_id ) { |
| 20 |
ob_start(); |
| 21 |
block_template_part('header'); |
| 22 |
$header = ob_get_clean(); |
| 23 |
echo '<header class="wp-block-template-part">'.$header.'</header>'; |
| 24 |
} |
| 25 |
} else { |
| 26 |
get_header(); |
| 27 |
} |
| 28 |
|
| 29 |
do_action( 'ultp_before_content' ); |
| 30 |
|
| 31 |
$page_id = ultimate_post()->conditions('return'); |
| 32 |
|
| 33 |
$width = $page_id ? ( get_post_meta($page_id, '__container_width', true) ? get_post_meta($page_id, '__container_width', true) : '1140' ) : '1140'; |
| 34 |
$sidebar = $page_id ? get_post_meta($page_id, '__builder_sidebar', true) : ''; |
| 35 |
$widget_area = $page_id ? get_post_meta($page_id, '__builder_widget_area', true) : ''; |
| 36 |
$has_widget = ($sidebar && $widget_area != '') ? true : false; |
| 37 |
|
| 38 |
echo '<div class="ultp-builder-container'.(esc_html($has_widget?' ultp-widget-'.$sidebar:'')).(esc_html(' ultp-builderid-'.$page_id)).'" style="margin:0 auto; width: -webkit-fill-available; width: -moz-available; max-width: '.esc_html($width).'px;">'; |
| 39 |
if ($has_widget && $sidebar == 'left') { |
| 40 |
echo '<div class="ultp-sidebar-left">'; |
| 41 |
if (is_active_sidebar($widget_area)) { |
| 42 |
dynamic_sidebar($widget_area); |
| 43 |
} |
| 44 |
echo '</div>'; |
| 45 |
} |
| 46 |
echo '<div class="ultp-builder-wrap">'; |
| 47 |
if ($page_id) { |
| 48 |
/* Content Filtering for elementor & divi */ |
| 49 |
$builder_type = ''; |
| 50 |
$body_class = get_body_class(); |
| 51 |
$divi_settings = ultimate_post()->get_setting('ultp_divi'); |
| 52 |
$elem_settings = ultimate_post()->get_setting('ultp_elementor'); |
| 53 |
if($divi_settings == 'true' && class_exists( 'ET_Builder_Module' ) && in_array('et-fb', $body_class)) { |
| 54 |
$builder_type = 'divi'; |
| 55 |
} else if( did_action( 'elementor/loaded' ) && $elem_settings == 'true' && in_array('elementor-editor-active', $body_class) && in_array('elementor-editor-wp-post', $body_class) ) { |
| 56 |
$builder_type = 'elementor'; |
| 57 |
} |
| 58 |
/* Content Filtering for elementor & divi */ |
| 59 |
ultimate_post()->content($page_id, $builder_type); |
| 60 |
} else { |
| 61 |
the_content(); |
| 62 |
} |
| 63 |
echo '</div>'; |
| 64 |
if ($has_widget && $sidebar == 'right') { |
| 65 |
echo '<div class="ultp-sidebar-right">'; |
| 66 |
if (is_active_sidebar($widget_area)) { |
| 67 |
dynamic_sidebar($widget_area); |
| 68 |
} |
| 69 |
echo '</div>'; |
| 70 |
} |
| 71 |
echo '</div>'; |
| 72 |
|
| 73 |
do_action( 'ultp_after_content' ); |
| 74 |
|
| 75 |
|
| 76 |
if ( wp_is_block_theme() ) { |
| 77 |
?> |
| 78 |
</body> |
| 79 |
</html> |
| 80 |
<?php |
| 81 |
if ( !$footer_id ) { |
| 82 |
ob_start(); |
| 83 |
block_template_part('footer'); |
| 84 |
$footer = ob_get_clean(); |
| 85 |
echo '<footer class="wp-block-template-part">'.$footer.'</footer>'; |
| 86 |
} |
| 87 |
if ( $header_id ) { |
| 88 |
$GLOBALS['wp_filter']; |
| 89 |
if ( isset($GLOBALS['wp_filter']['wp_head']) && $GLOBALS['wp_filter']['wp_head']->callbacks && !empty($GLOBALS['wp_filter']['wp_head']->callbacks) ) { |
| 90 |
$callbacks = $GLOBALS['wp_filter']['wp_head']->callbacks; |
| 91 |
foreach($callbacks as $k => $val) { |
| 92 |
if (isset($val) && !empty($val) ) { |
| 93 |
foreach($val as $pp => $qq) { |
| 94 |
if ( $pp && strpos($pp, 'header_builder_template' ) > -1) { |
| 95 |
remove_action('wp_head', $pp); |
| 96 |
} |
| 97 |
} |
| 98 |
} |
| 99 |
} |
| 100 |
} |
| 101 |
} |
| 102 |
wp_head(); |
| 103 |
wp_footer(); |
| 104 |
} else { |
| 105 |
get_footer(); |
| 106 |
} |