| @@ -1,16 +1,69 @@ | ||
| 1 | 1 | <?php |
| 2 | -defined('ABSPATH') || exit; | |
| 2 | +defined( 'ABSPATH' ) || exit; | |
| 3 | 3 | |
| 4 | -get_header(); | |
| 5 | -$width = ultimate_post()->get_setting(); | |
| 6 | -$width = isset($width['container_width']) ? $width['container_width'] : '1140'; | |
| 4 | +$is_block_theme = wp_is_block_theme(); | |
| 5 | + | |
| 6 | +global $ULTP_HEADER_ID; | |
| 7 | +global $ULTP_FOOTER_ID; | |
| 8 | +$builder_active = ultimate_post()->get_setting( 'ultp_builder' ) != 'false'; | |
| 9 | +$has_header = $builder_active ? $ULTP_HEADER_ID : ''; | |
| 10 | +$has_footer = $builder_active ? $ULTP_FOOTER_ID : ''; | |
| 11 | + | |
| 12 | +if ( $is_block_theme ) { | |
| 13 | + ?><!DOCTYPE html> | |
| 14 | + <html <?php language_attributes(); ?>> | |
| 15 | + <head> | |
| 16 | + <meta charset="<?php bloginfo( 'charset' ); ?>" /> | |
| 17 | + <?php | |
| 18 | + wp_head(); | |
| 19 | + ?> | |
| 20 | + </head> | |
| 21 | + <body <?php body_class(); ?>> | |
| 22 | + <?php | |
| 23 | + wp_body_open(); | |
| 24 | + | |
| 25 | + if ( ! $has_header ) { | |
| 26 | + ob_start(); | |
| 27 | + block_template_part( 'header' ); | |
| 28 | + $header = ob_get_clean(); | |
| 29 | + echo '<header class="wp-block-template-part">' . $header . '</header>'; | |
| 30 | + } | |
| 31 | +} else { | |
| 32 | + get_header(); | |
| 33 | +} | |
| 34 | + | |
| 35 | +do_action( 'ultp_before_content' ); | |
| 36 | + | |
| 37 | +$width = ultimate_post()->get_setting( 'container_width' ); | |
| 38 | +$width = $width ? $width : '1140'; | |
| 7 | 39 | ?> |
| 8 | -<div class="ultp-template-container" style="margin:0 auto;max-width:<?php echo $width;?>px; padding: 0 15px"> | |
| 40 | +<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;"> | |
| 9 | 41 | <?php |
| 10 | - while ( have_posts() ) : the_post(); | |
| 11 | - the_content(); | |
| 42 | + while ( have_posts() ) : | |
| 43 | + the_post(); | |
| 44 | + the_content(); | |
| 45 | + if ( comments_open() || get_comments_number() ) { | |
| 46 | + comments_template(); | |
| 47 | + } | |
| 12 | 48 | endwhile; |
| 13 | 49 | ?> |
| 14 | -<div> | |
| 50 | +</div> | |
| 51 | + | |
| 15 | 52 | <?php |
| 16 | -get_footer(); | |
| 53 | +do_action( 'ultp_after_content' ); | |
| 54 | +if ( $is_block_theme ) { | |
| 55 | + ?> | |
| 56 | + </body> | |
| 57 | + </html> | |
| 58 | + <?php | |
| 59 | + if ( ! $has_footer ) { | |
| 60 | + ob_start(); | |
| 61 | + block_template_part( 'footer' ); | |
| 62 | + $footer = ob_get_clean(); | |
| 63 | + echo '<footer class="wp-block-template-part">' . $footer . '</footer>'; | |
| 64 | + } | |
| 65 | + // wp_head(); // all ready wp head declared in header, i can not find any conflict to check that, if you find any conflict for removing then use it | |
| 66 | + wp_footer(); | |
| 67 | +} else { | |
| 68 | + get_footer(); | |
| 69 | +} | |