| 1 |
<?php |
| 2 |
defined('ABSPATH') || exit; |
| 3 |
|
| 4 |
use FluentCart\App\Vite; |
| 5 |
|
| 6 |
// The is_page() guard below exists for the shortcode path, where this view |
| 7 |
// renders INSIDE a real page whose wp_head() already ran. A route that takes |
| 8 |
// over the request and renders a whole document is the opposite case: it needs |
| 9 |
// wp_head()/wp_footer() precisely BECAUSE nothing else will print them — and |
| 10 |
// on a site with a static front page, a route hanging off home_url() makes |
| 11 |
// is_page() true for reasons that have nothing to do with this view. Passing |
| 12 |
// true explicitly says "I am the whole document", and forces the call. |
| 13 |
$force_wp_head = isset($wp_head) && $wp_head === true; |
| 14 |
$force_wp_footer = isset($wp_footer) && $wp_footer === true; |
| 15 |
|
| 16 |
$wp_head = !((isset($wp_head) && $wp_head === false)); |
| 17 |
$wp_footer = !((isset($wp_footer) && $wp_footer == false)); |
| 18 |
?> |
| 19 |
<!DOCTYPE html> |
| 20 |
<html> |
| 21 |
|
| 22 |
<?php if (!empty($title)): ?> |
| 23 |
|
| 24 |
<title><?php echo esc_html($title) ?></title> |
| 25 |
<?php endif; ?> |
| 26 |
<?php |
| 27 |
|
| 28 |
|
| 29 |
if (($force_wp_head || !is_page()) && \FluentCart\App\App::request()->get('action') !== 'elementor' && $wp_head) { |
| 30 |
remove_action('wp_head', 'print_emoji_detection_script', 7); |
| 31 |
remove_action('wp_print_styles', 'print_emoji_styles'); |
| 32 |
wp_head(); |
| 33 |
} |
| 34 |
|
| 35 |
if (isset($styles) && is_array($styles) && !empty($enqueue_prefix)) { |
| 36 |
Vite::printAllStyles($styles, $enqueue_prefix.'_styles'); |
| 37 |
} |
| 38 |
?> |
| 39 |
<body class="<?php echo esc_attr(implode(' ', \FluentCart\App\Services\Theme\FrontendTheme::bodyClasses([]))); ?>"> |
| 40 |
|
| 41 |
<div style="width: 100%; box-sizing: border-box"> |
| 42 |
<?php echo $content; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?> |
| 43 |
</div> |
| 44 |
</body> |
| 45 |
|
| 46 |
<?php |
| 47 |
|
| 48 |
if (function_exists('wp_enqueue_block_template_skip_link')) { |
| 49 |
wp_enqueue_block_template_skip_link(); |
| 50 |
} |
| 51 |
|
| 52 |
if (($force_wp_footer || !is_page()) && \FluentCart\App\App::request()->get('action') !== 'elementor' && $wp_footer) { |
| 53 |
wp_footer(); |
| 54 |
} |
| 55 |
|
| 56 |
if (isset($scripts) && is_array($scripts) && !empty($enqueue_prefix)) { |
| 57 |
Vite::printAllScripts($scripts, $enqueue_prefix.'_scripts'); |
| 58 |
} |
| 59 |
?> |
| 60 |
</html> |
| 61 |
|