| 1 |
<?php |
| 2 |
/** |
| 3 |
* Imported-chrome canvas — the plugin-served template for takeover pages. |
| 4 |
* |
| 5 |
* Structure ONLY, zero design opinions: all design comes from the imported |
| 6 |
* blocks (GBS-self-contained) and whatever the site enqueues through the |
| 7 |
* normal `wp_head`/`wp_footer` pipelines (theme CSS included — same proven |
| 8 |
* behavior as the FSE lane). Rendered when `Imported_Chrome::maybe_takeover` |
| 9 |
* resolves a scope: |
| 10 |
* site — imported header part · content · imported footer part |
| 11 |
* page — content only (standalone pages embed their chrome in post_content) |
| 12 |
* |
| 13 |
* Known limitation (documented, not fixed): themes that print UI via |
| 14 |
* `wp_head`/`wp_footer`/`wp_body_open` (mobile drawers, preloaders) keep |
| 15 |
* printing it inside the canvas. |
| 16 |
* |
| 17 |
* @since 0.0.8 |
| 18 |
* @package zip-ai |
| 19 |
*/ |
| 20 |
|
| 21 |
use ZipAI\MCP\Classes\Core\Imported_Chrome; |
| 22 |
|
| 23 |
if ( ! defined( 'ABSPATH' ) ) { |
| 24 |
exit; |
| 25 |
} |
| 26 |
|
| 27 |
$zipai_scope = Imported_Chrome::$scope; |
| 28 |
?> |
| 29 |
<!DOCTYPE html> |
| 30 |
<html <?php language_attributes(); ?>> |
| 31 |
<head> |
| 32 |
<meta charset="<?php bloginfo( 'charset' ); ?>" /> |
| 33 |
<meta name="viewport" content="width=device-width, initial-scale=1" /> |
| 34 |
<?php if ( ! current_theme_supports( 'title-tag' ) ) : ?> |
| 35 |
<?php // Legacy themes print their <title> in header.php, which never runs here (the Elementor-Canvas guard). ?> |
| 36 |
<title><?php echo esc_html( wp_get_document_title() ); ?></title> |
| 37 |
<?php endif; ?> |
| 38 |
<?php wp_head(); ?> |
| 39 |
</head> |
| 40 |
<body <?php body_class( 'zipai-chrome-canvas' ); ?>> |
| 41 |
<?php wp_body_open(); ?> |
| 42 |
<?php if ( 'site' === $zipai_scope ) : ?> |
| 43 |
<?php |
| 44 |
// Imported block markup, admin-authored via the importer. |
| 45 |
echo do_blocks( Imported_Chrome::imported_part( 'header' ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 46 |
?> |
| 47 |
<?php endif; ?> |
| 48 |
<main class="zipai-canvas-content"> |
| 49 |
<?php if ( is_singular() ) : ?> |
| 50 |
<?php |
| 51 |
while ( have_posts() ) { |
| 52 |
the_post(); |
| 53 |
// Imported pages carry their H1 in post_content; non-imported |
| 54 |
// singulars keep their headline (title-unless-marker rule). |
| 55 |
if ( ! Imported_Chrome::is_imported_post() ) { |
| 56 |
echo '<h1 class="zipai-canvas-title entry-title">' . esc_html( get_the_title() ) . '</h1>'; |
| 57 |
} |
| 58 |
echo '<div class="entry-content">'; |
| 59 |
the_content(); |
| 60 |
wp_link_pages(); |
| 61 |
echo '</div>'; |
| 62 |
if ( comments_open() || get_comments_number() ) { |
| 63 |
comments_template(); |
| 64 |
} |
| 65 |
} |
| 66 |
?> |
| 67 |
<?php else : ?> |
| 68 |
<?php if ( have_posts() ) : ?> |
| 69 |
<ul class="zipai-canvas-archive"> |
| 70 |
<?php |
| 71 |
while ( have_posts() ) { |
| 72 |
the_post(); |
| 73 |
$zipai_permalink = get_permalink(); |
| 74 |
if ( false === $zipai_permalink ) { |
| 75 |
continue; |
| 76 |
} |
| 77 |
echo '<li><a href="' . esc_url( $zipai_permalink ) . '">' . esc_html( get_the_title() ) . '</a>'; |
| 78 |
echo '<p>' . esc_html( get_the_excerpt() ) . '</p></li>'; |
| 79 |
} |
| 80 |
?> |
| 81 |
</ul> |
| 82 |
<?php the_posts_pagination(); ?> |
| 83 |
<?php else : ?> |
| 84 |
<p class="zipai-canvas-empty"><?php esc_html_e( 'Nothing found.', 'zip-ai' ); ?></p> |
| 85 |
<?php endif; ?> |
| 86 |
<?php endif; ?> |
| 87 |
</main> |
| 88 |
<?php if ( 'site' === $zipai_scope ) : ?> |
| 89 |
<?php |
| 90 |
// Imported block markup, admin-authored via the importer. |
| 91 |
echo do_blocks( Imported_Chrome::imported_part( 'footer' ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 92 |
?> |
| 93 |
<?php endif; ?> |
| 94 |
<?php wp_footer(); ?> |
| 95 |
</body> |
| 96 |
</html> |
| 97 |
|