| 1 |
<?php |
| 2 |
defined( 'ABSPATH' ) || exit; |
| 3 |
|
| 4 |
$is_block_theme = wp_is_block_theme(); |
| 5 |
$header_id = ultimate_post()->conditions( 'header' ); |
| 6 |
$footer_id = ultimate_post()->conditions( 'footer' ); |
| 7 |
|
| 8 |
if( $is_block_theme ) { |
| 9 |
?><!DOCTYPE html> |
| 10 |
<html <?php language_attributes(); ?>> |
| 11 |
<head> |
| 12 |
<meta charset="<?php bloginfo( 'charset' ); ?>" /> |
| 13 |
<?php |
| 14 |
wp_head(); |
| 15 |
?> |
| 16 |
</head> |
| 17 |
<body <?php body_class(); ?>> |
| 18 |
<?php wp_body_open(); |
| 19 |
|
| 20 |
if( !$header_id ) { |
| 21 |
ob_start(); |
| 22 |
block_template_part('header'); |
| 23 |
$header = ob_get_clean(); |
| 24 |
echo '<header class="wp-block-template-part">'.$header.'</header>'; |
| 25 |
} |
| 26 |
} else { |
| 27 |
get_header(); |
| 28 |
} |
| 29 |
|
| 30 |
do_action( 'ultp_before_content' ); |
| 31 |
|
| 32 |
$width = ultimate_post()->get_setting( 'container_width' ); |
| 33 |
$width = $width ? $width : '1140'; |
| 34 |
?> |
| 35 |
<div class="ultp-template-container" style="margin:0 auto;max-width:<?php echo esc_attr( $width ); ?>px; padding: 0 15px; width: -webkit-fill-available; width: -moz-available;"> |
| 36 |
<?php |
| 37 |
while ( have_posts() ) : the_post(); |
| 38 |
the_content(); |
| 39 |
if ( comments_open() || get_comments_number() ) { |
| 40 |
comments_template(); |
| 41 |
} |
| 42 |
endwhile; |
| 43 |
?> |
| 44 |
</div> |
| 45 |
|
| 46 |
<?php |
| 47 |
do_action( 'ultp_after_content' ); |
| 48 |
if( $is_block_theme ) { |
| 49 |
?> |
| 50 |
</body> |
| 51 |
</html> |
| 52 |
<?php |
| 53 |
if ( !$footer_id ) { |
| 54 |
ob_start(); |
| 55 |
block_template_part('footer'); |
| 56 |
$footer = ob_get_clean(); |
| 57 |
echo '<footer class="wp-block-template-part">'.$footer.'</footer>'; |
| 58 |
} |
| 59 |
if ( $header_id ) { |
| 60 |
$GLOBALS['wp_filter']; |
| 61 |
if ( isset($GLOBALS['wp_filter']['wp_head']) && $GLOBALS['wp_filter']['wp_head']->callbacks && !empty($GLOBALS['wp_filter']['wp_head']->callbacks) ) { |
| 62 |
$callbacks = $GLOBALS['wp_filter']['wp_head']->callbacks; |
| 63 |
foreach($callbacks as $k => $val) { |
| 64 |
if (isset($val) && !empty($val) ) { |
| 65 |
foreach($val as $pp => $qq) { |
| 66 |
if ( $pp && strpos($pp, 'header_builder_template' ) > -1) { |
| 67 |
remove_action('wp_head', $pp); |
| 68 |
} |
| 69 |
} |
| 70 |
} |
| 71 |
} |
| 72 |
} |
| 73 |
} |
| 74 |
wp_head(); |
| 75 |
wp_footer(); |
| 76 |
} else { |
| 77 |
get_footer(); |
| 78 |
} |