| 1 |
<?php |
| 2 |
/** |
| 3 |
* LAYOUT: one full-width clickable artwork plus a close button. No live text |
| 4 |
* at all — every word is baked into the image, so nothing here is translatable |
| 5 |
* or themeable. |
| 6 |
* |
| 7 |
* Self-contained: markup and CSS in this one file, every class built from |
| 8 |
* $prefix so a sibling plugin can copy it as-is. |
| 9 |
* |
| 10 |
* @var array $notice Promo entry (banner_src, url, close_color). |
| 11 |
* @var array $query_args Dismiss-link query args. |
| 12 |
* @var string $prefix Identity slug from config.php. |
| 13 |
*/ |
| 14 |
|
| 15 |
defined( 'ABSPATH' ) || exit; |
| 16 |
|
| 17 |
$wrapper_class = $prefix . '-notice-wrapper'; |
| 18 |
$image_wrap_class = $prefix . '-image-notice-wrapper'; |
| 19 |
$banner_class = $prefix . '-image-banner'; |
| 20 |
$btn_image_class = $prefix . '-btn-image'; |
| 21 |
$close_class = $prefix . '-content-notice-close'; |
| 22 |
$close_icon_class = $prefix . '-content-notice-close-icon'; |
| 23 |
$scope = '.' . $wrapper_class . '.' . $image_wrap_class; |
| 24 |
?> |
| 25 |
<style type="text/css"> |
| 26 |
<?php echo esc_html( $scope ); ?> { |
| 27 |
padding: 0 !important; |
| 28 |
position: relative; |
| 29 |
box-sizing: border-box; |
| 30 |
overflow: hidden; |
| 31 |
border-radius: 0px; |
| 32 |
border: none !important; |
| 33 |
} |
| 34 |
<?php echo esc_html( $scope ); ?> .<?php echo esc_html( $banner_class ); ?> { |
| 35 |
position: relative; |
| 36 |
line-height: 0; |
| 37 |
} |
| 38 |
<?php echo esc_html( $scope ); ?> .<?php echo esc_html( $btn_image_class ); ?> { |
| 39 |
display: block; |
| 40 |
} |
| 41 |
<?php echo esc_html( $scope ); ?> .<?php echo esc_html( $btn_image_class ); ?> img { |
| 42 |
display: block; |
| 43 |
width: 100%; |
| 44 |
height: auto; |
| 45 |
border-radius: 0; |
| 46 |
} |
| 47 |
<?php echo esc_html( $scope ); ?> .<?php echo esc_html( $close_class ); ?> { |
| 48 |
top: 4px; |
| 49 |
right: 4px; |
| 50 |
position: absolute; |
| 51 |
z-index: 999; |
| 52 |
text-decoration: none; |
| 53 |
} |
| 54 |
<?php echo esc_html( $scope ); ?> .<?php echo esc_html( $close_icon_class ); ?> { |
| 55 |
font-size: 14px; |
| 56 |
} |
| 57 |
@media screen and (max-width: 650px) { |
| 58 |
.<?php echo esc_html( $image_wrap_class ); ?> { |
| 59 |
display: none; |
| 60 |
} |
| 61 |
} |
| 62 |
</style> |
| 63 |
<div class="<?php echo esc_attr( $wrapper_class . ' ' . $image_wrap_class . ' notice' ); ?>"> |
| 64 |
<div class="<?php echo esc_attr( $banner_class ); ?>"> |
| 65 |
<a class="<?php echo esc_attr( $close_class ); ?>" href=" |
| 66 |
<?php |
| 67 |
echo esc_url( |
| 68 |
add_query_arg( |
| 69 |
$query_args |
| 70 |
) |
| 71 |
); |
| 72 |
?> |
| 73 |
"><span class="<?php echo esc_attr( $close_icon_class ); ?> dashicons dashicons-dismiss" style="color: <?php echo esc_attr( $notice['close_color'] ); ?>;"> </span></a> |
| 74 |
<a class="<?php echo esc_attr( $btn_image_class ); ?>" target="_blank" href="<?php echo esc_url( $notice['url'] ); ?>"> |
| 75 |
<img loading="lazy" src="<?php echo esc_url( $notice['banner_src'] ); ?>" alt="Discount Banner"/> |
| 76 |
</a> |
| 77 |
</div> |
| 78 |
</div> |
| 79 |
|