| 1 |
<?php |
| 2 |
/** |
| 3 |
* Popup Canvas Template for Elementor Preview |
| 4 |
* This template is used when previewing popups in Elementor editor |
| 5 |
*/ |
| 6 |
|
| 7 |
if (!defined('ABSPATH')) { |
| 8 |
exit; // Exit if accessed directly. |
| 9 |
} |
| 10 |
|
| 11 |
?> |
| 12 |
<!DOCTYPE html> |
| 13 |
<html <?php language_attributes(); ?>> |
| 14 |
<head> |
| 15 |
<meta charset="<?php bloginfo('charset'); ?>"> |
| 16 |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> |
| 17 |
<title><?php echo esc_html( get_the_title() ) . ' - Popup Preview'; ?></title> |
| 18 |
<?php wp_head(); ?> |
| 19 |
<style> |
| 20 |
body { |
| 21 |
margin: 0; |
| 22 |
padding: 20px; |
| 23 |
background: #f5f5f5; |
| 24 |
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; |
| 25 |
} |
| 26 |
|
| 27 |
.jltma-popup-preview-container { |
| 28 |
max-width: 1200px; |
| 29 |
margin: 0 auto; |
| 30 |
background: white; |
| 31 |
border-radius: 8px; |
| 32 |
box-shadow: 0 4px 20px rgba(0,0,0,0.1); |
| 33 |
overflow: hidden; |
| 34 |
} |
| 35 |
|
| 36 |
.jltma-popup-preview-header { |
| 37 |
background: #2271b1; |
| 38 |
color: white; |
| 39 |
padding: 15px 20px; |
| 40 |
display: flex; |
| 41 |
align-items: center; |
| 42 |
gap: 10px; |
| 43 |
} |
| 44 |
|
| 45 |
.jltma-popup-preview-header h1 { |
| 46 |
margin: 0; |
| 47 |
font-size: 18px; |
| 48 |
font-weight: 500; |
| 49 |
} |
| 50 |
|
| 51 |
.jltma-popup-preview-body { |
| 52 |
padding: 0; |
| 53 |
min-height: 500px; |
| 54 |
position: relative; |
| 55 |
} |
| 56 |
|
| 57 |
/* Popup canvas styling */ |
| 58 |
.jltma-popup-canvas { |
| 59 |
width: 100%; |
| 60 |
min-height: 500px; |
| 61 |
position: relative; |
| 62 |
background: white; |
| 63 |
} |
| 64 |
|
| 65 |
.jltma-popup-canvas.jltma-popup-type-modal { |
| 66 |
max-width: 600px; |
| 67 |
margin: 40px auto; |
| 68 |
border-radius: 8px; |
| 69 |
box-shadow: 0 10px 40px rgba(0,0,0,0.2); |
| 70 |
} |
| 71 |
|
| 72 |
.jltma-popup-canvas.jltma-popup-type-slide-in { |
| 73 |
max-width: 400px; |
| 74 |
margin: 20px; |
| 75 |
margin-left: auto; |
| 76 |
border-radius: 8px; |
| 77 |
box-shadow: 0 4px 20px rgba(0,0,0,0.15); |
| 78 |
} |
| 79 |
|
| 80 |
.jltma-popup-canvas.jltma-popup-type-notification { |
| 81 |
width: 100%; |
| 82 |
margin: 0; |
| 83 |
border-radius: 0; |
| 84 |
min-height: 80px; |
| 85 |
} |
| 86 |
|
| 87 |
.jltma-popup-canvas.jltma-popup-type-full-screen { |
| 88 |
width: 100%; |
| 89 |
min-height: 100vh; |
| 90 |
margin: 0; |
| 91 |
border-radius: 0; |
| 92 |
} |
| 93 |
|
| 94 |
/* Elementor editor specific styles */ |
| 95 |
.elementor-editor-active .jltma-popup-canvas { |
| 96 |
border: 2px dashed #e0e0e0; |
| 97 |
} |
| 98 |
|
| 99 |
.elementor-editor-active .jltma-popup-canvas:hover { |
| 100 |
border-color: #2271b1; |
| 101 |
} |
| 102 |
</style> |
| 103 |
</head> |
| 104 |
<body <?php body_class('jltma-popup-preview'); ?>> |
| 105 |
|
| 106 |
<div class="jltma-popup-preview-container"> |
| 107 |
<div class="jltma-popup-preview-header"> |
| 108 |
<svg width="24" height="24" viewBox="0 0 24 24" fill="currentColor"> |
| 109 |
<path d="M3,3H21V5H3V3M4,6H20V21H4V6M5,7V20H19V7H5Z" /> |
| 110 |
</svg> |
| 111 |
<h1><?php echo esc_html( get_the_title() ); ?> - Popup Preview</h1> |
| 112 |
</div> |
| 113 |
|
| 114 |
<div class="jltma-popup-preview-body"> |
| 115 |
<?php |
| 116 |
// Output the Elementor content |
| 117 |
if (class_exists('\Elementor\Plugin')) { |
| 118 |
echo \Elementor\Plugin::instance()->frontend->get_builder_content_for_display(get_the_ID()); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Elementor's get_builder_content_for_display returns sanitized HTML |
| 119 |
} else { |
| 120 |
echo '<div style="padding: 40px; text-align: center; color: #666;">Elementor is required to preview popup content.</div>'; |
| 121 |
} |
| 122 |
?> |
| 123 |
</div> |
| 124 |
</div> |
| 125 |
|
| 126 |
<?php wp_footer(); ?> |
| 127 |
</body> |
| 128 |
</html> |