added cron and waiting

This commit is contained in:
2026-09-18 15:36:44 +02:00
parent c9a0cc6034
commit 9a423414a7
8 changed files with 406 additions and 514 deletions
@@ -1,497 +1,153 @@
/* YogaSoul Eventi — stili widget (namespaced .yse-) */
/* YogaSoul Eventi — stili widget.
Tutti i selettori sono prefissati con .yse-widget per alzare la specificità
sopra le regole del tema WordPress (evita che tema "vinca" su colori/font). */
.yse-widget {
--yse-ink: #2b2622;
--yse-muted: #8c837c;
--yse-line: #ece7e2;
--yse-card: #ffffff;
max-width: 720px;
max-width: 1140px; /* largo come Amelia; su schermi piccoli riempie il contenitore */
width: 100%;
margin: 0 auto;
font-family:
"Inter",
system-ui,
-apple-system,
sans-serif;
font-family: inherit;
color: var(--yse-ink);
line-height: 1.55;
text-align: left;
}
.yse-widget * {
box-sizing: border-box;
}
.yse-empty {
text-align: center;
color: var(--yse-muted);
padding: 26px;
}
.yse-widget, .yse-widget * { box-sizing: border-box; }
.yse-card {
--yse-accent: #4caf50;
/* --- Reset mirati contro il tema --- */
.yse-widget button {
font-family: inherit;
background: none !important;
border: none !important;
box-shadow: none !important;
text-transform: none !important;
letter-spacing: normal !important;
min-height: 0 !important;
width: auto;
margin: 0;
line-height: 1.2;
}
.yse-widget button:hover { filter: none; }
.yse-widget input {
font-family: inherit;
margin: 0;
width: 100%;
min-height: 0;
box-shadow: none;
}
.yse-widget h3, .yse-widget h4, .yse-widget p { margin: 0; padding: 0; }
.yse-widget img { max-width: 100%; height: auto; }
.yse-widget a { text-decoration: none; }
.yse-widget svg { vertical-align: middle; }
.yse-empty { text-align: center; color: var(--yse-muted); padding: 26px; }
.yse-widget .yse-card {
--yse-accent: #4CAF50;
--yse-accent-soft: color-mix(in srgb, var(--yse-accent) 10%, white);
--yse-accent-ink: color-mix(in srgb, var(--yse-accent) 62%, black);
background: var(--yse-card);
border-radius: 18px;
box-shadow: 0 14px 40px rgba(43, 38, 34, 0.1);
box-shadow: 0 14px 40px rgba(43, 38, 34, 0.10);
overflow: hidden;
}
.yse-card + .yse-card {
margin-top: 22px;
}
.yse-widget .yse-card + .yse-card { margin-top: 24px; }
/* Header compatto */
.yse-chead {
display: flex;
gap: 16px;
padding: 18px 22px;
align-items: flex-start;
}
.yse-datechip {
flex-shrink: 0;
border: 1px solid var(--yse-line);
border-radius: 12px;
padding: 7px 11px 5px;
text-align: center;
min-width: 54px;
}
.yse-datechip .yse-m {
font-size: 10.5px;
font-weight: 600;
letter-spacing: 0.12em;
color: var(--yse-accent-ink);
}
.yse-datechip .yse-d {
font-family: "Fraunces", serif;
font-size: 23px;
font-weight: 600;
color: var(--yse-ink);
line-height: 1;
}
.yse-main {
flex: 1;
min-width: 0;
}
.yse-title-row {
display: flex;
align-items: center;
gap: 10px;
flex-wrap: wrap;
}
.yse-title-row h3 {
font-family: "Fraunces", serif;
font-weight: 500;
font-size: 21px;
margin: 0;
color: var(--yse-ink);
}
.yse-toggle {
background: none;
border: none;
color: var(--yse-accent-ink);
font-weight: 600;
font-size: 13px;
cursor: pointer;
display: inline-flex;
align-items: center;
gap: 4px;
padding: 2px;
}
.yse-toggle svg {
width: 15px;
height: 15px;
transition: transform 0.2s;
}
.yse-toggle.yse-on svg {
transform: rotate(180deg);
}
.yse-meta {
display: flex;
flex-wrap: wrap;
gap: 6px 20px;
margin-top: 9px;
}
.yse-item {
display: flex;
align-items: center;
gap: 7px;
color: var(--yse-muted);
font-size: 13.5px;
}
.yse-item svg {
width: 16px;
height: 16px;
color: var(--yse-accent-ink);
flex-shrink: 0;
}
.yse-item strong {
color: var(--yse-ink);
font-weight: 600;
}
.yse-price {
flex-shrink: 0;
align-self: flex-start;
background: var(--yse-accent);
color: #fff;
font-weight: 600;
font-size: 14px;
padding: 7px 13px;
border-radius: 999px;
}
.yse-widget .yse-chead { display: flex; gap: 18px; padding: 20px 26px; align-items: flex-start; }
.yse-widget .yse-datechip { flex-shrink: 0; border: 1px solid var(--yse-line); border-radius: 12px; padding: 7px 12px 5px; text-align: center; min-width: 58px; }
.yse-widget .yse-datechip .yse-m { font-size: 11px; font-weight: 600; letter-spacing: .12em; color: var(--yse-accent-ink); }
.yse-widget .yse-datechip .yse-d { font-family: inherit; font-size: 24px; font-weight: 600; color: var(--yse-ink); line-height: 1; }
.yse-widget .yse-main { flex: 1; min-width: 0; }
.yse-widget .yse-title-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.yse-widget .yse-title-row h3 { font-family: inherit; font-weight: 500; font-size: 23px; margin: 0; color: var(--yse-ink); }
.yse-widget .yse-toggle { background: none !important; border: none !important; color: var(--yse-accent-ink) !important; font-weight: 600; font-size: 13px; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; padding: 2px; border-radius: 0; }
.yse-widget .yse-toggle svg { width: 15px; height: 15px; transition: transform .2s; }
.yse-widget .yse-toggle.yse-on svg { transform: rotate(180deg); }
.yse-widget .yse-meta { display: flex; flex-wrap: wrap; gap: 6px 22px; margin-top: 10px; }
.yse-widget .yse-item { display: flex; align-items: center; gap: 7px; color: var(--yse-muted); font-size: 14px; }
.yse-widget .yse-item svg { width: 17px; height: 17px; color: var(--yse-accent-ink); flex-shrink: 0; }
.yse-widget .yse-item strong { color: var(--yse-ink); font-weight: 600; }
.yse-widget .yse-price { flex-shrink: 0; align-self: flex-start; background: var(--yse-accent) !important; color: #fff; font-weight: 600; font-size: 15px; padding: 8px 15px; border-radius: 999px; }
/* Dettagli espandibili */
.yse-details {
display: none;
border-top: 1px solid var(--yse-line);
}
.yse-details.yse-open {
display: block;
}
.yse-hero {
position: relative;
height: 260px;
background: linear-gradient(
135deg,
var(--yse-accent-ink),
var(--yse-accent)
);
}
.yse-hero img {
width: 100%;
height: 100%;
object-fit: cover;
display: block;
}
.yse-emblem {
position: absolute;
inset: 0;
display: flex;
align-items: center;
justify-content: center;
color: rgba(255, 255, 255, 0.35);
}
.yse-emblem svg {
width: 72px;
height: 72px;
}
.yse-body {
padding: 22px;
}
.yse-section {
margin-top: 24px;
}
.yse-body h4 {
font-family: "Fraunces", serif;
font-weight: 600;
font-size: 18px;
color: var(--yse-ink);
margin: 0 0 10px;
display: flex;
align-items: center;
gap: 9px;
}
.yse-body h4 svg {
width: 19px;
height: 19px;
color: var(--yse-accent-ink);
}
.yse-desc {
font-size: 15px;
color: #4a433d;
}
.yse-desc p {
margin: 0 0 10px;
}
.yse-desc img {
max-width: 100%;
border-radius: 10px;
}
.yse-detail-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
gap: 12px;
margin-top: 22px;
}
.yse-detail {
background: var(--yse-accent-soft);
border: 1px solid color-mix(in srgb, var(--yse-accent) 18%, white);
border-radius: 13px;
padding: 14px 15px;
}
.yse-dh {
display: flex;
align-items: center;
gap: 8px;
font-weight: 600;
color: var(--yse-accent-ink);
margin-bottom: 6px;
font-size: 13.5px;
}
.yse-dh svg {
width: 16px;
height: 16px;
}
.yse-dt {
font-size: 13.5px;
color: #4a433d;
}
.yse-gallery {
display: flex;
gap: 10px;
flex-wrap: wrap;
}
.yse-gallery img {
width: 100px;
height: 100px;
object-fit: cover;
border-radius: 11px;
cursor: pointer;
transition:
transform 0.15s,
box-shadow 0.15s;
}
.yse-gallery img:hover {
transform: translateY(-2px);
box-shadow: 0 8px 18px rgba(0, 0, 0, 0.15);
}
.yse-map {
border: 0;
width: 100%;
height: 210px;
border-radius: 13px;
display: block;
}
.yse-widget .yse-details { display: none; border-top: 1px solid var(--yse-line); }
.yse-widget .yse-details.yse-open { display: block; }
.yse-widget .yse-hero { position: relative; height: 300px; background: linear-gradient(135deg, var(--yse-accent-ink), var(--yse-accent)); }
.yse-widget .yse-hero img { width: 100%; height: 100%; object-fit: cover; display: block; }
.yse-widget .yse-emblem { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: rgba(255,255,255,.35); }
.yse-widget .yse-emblem svg { width: 78px; height: 78px; }
.yse-widget .yse-body { padding: 24px 26px; }
.yse-widget .yse-section { margin-top: 26px; }
.yse-widget .yse-body h4 { font-family: inherit; font-weight: 600; font-size: 19px; color: var(--yse-ink); margin: 0 0 10px; display: flex; align-items: center; gap: 9px; }
.yse-widget .yse-body h4 svg { width: 20px; height: 20px; color: var(--yse-accent-ink); }
.yse-widget .yse-desc { font-size: 15.5px; color: #4a433d; }
.yse-widget .yse-desc p { margin: 0 0 10px; }
.yse-widget .yse-desc img { max-width: 100%; border-radius: 10px; }
.yse-widget .yse-detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin-top: 24px; }
.yse-widget .yse-detail { background: var(--yse-accent-soft); border: 1px solid color-mix(in srgb, var(--yse-accent) 18%, white); border-radius: 14px; padding: 15px 16px; }
.yse-widget .yse-dh { display: flex; align-items: center; gap: 8px; font-weight: 600; color: var(--yse-accent-ink); margin-bottom: 6px; font-size: 14px; }
.yse-widget .yse-dh svg { width: 17px; height: 17px; }
.yse-widget .yse-dt { font-size: 14px; color: #4a433d; }
.yse-widget .yse-gallery { display: flex; gap: 10px; flex-wrap: wrap; }
.yse-widget .yse-gallery img { width: 108px; height: 108px; object-fit: cover; border-radius: 12px; cursor: pointer; transition: transform .15s, box-shadow .15s; }
.yse-widget .yse-gallery img:hover { transform: translateY(-2px); box-shadow: 0 8px 18px rgba(0,0,0,.15); }
.yse-widget .yse-map { border: 0; width: 100%; height: 220px; border-radius: 14px; display: block; }
/* Booking */
.yse-booking {
padding: 18px 22px;
border-top: 1px solid var(--yse-line);
}
.yse-soldout {
text-align: center;
font-weight: 600;
color: #c0392b;
}
.yse-wl-banner {
background: color-mix(in srgb, var(--yse-accent) 12%, white);
color: var(--yse-accent-ink);
border-radius: 12px;
padding: 12px 14px;
font-size: 13.5px;
margin-bottom: 14px;
}
.yse-bcompact {
display: flex;
align-items: flex-end;
gap: 18px;
flex-wrap: wrap;
}
.yse-btitle {
font-family: "Fraunces", serif;
font-weight: 600;
font-size: 18px;
color: var(--yse-ink);
margin-right: auto;
align-self: center;
}
.yse-lbl {
font-size: 12px;
color: var(--yse-muted);
text-transform: uppercase;
letter-spacing: 0.05em;
margin-bottom: 5px;
}
.yse-stepper {
display: flex;
align-items: center;
border: 1px solid var(--yse-line);
border-radius: 11px;
overflow: hidden;
background: #fff;
}
.yse-stepper button {
border: none;
background: #fff;
width: 42px;
height: 44px;
font-size: 21px;
color: var(--yse-accent-ink);
cursor: pointer;
line-height: 1;
}
.yse-stepper button:disabled {
color: #cfc8c2;
cursor: not-allowed;
}
.yse-num {
width: 50px;
text-align: center;
font-size: 16px;
font-weight: 600;
}
.yse-total .yse-val {
font-family: "Fraunces", serif;
font-size: 24px;
font-weight: 600;
color: var(--yse-accent-ink);
}
.yse-cta {
border: none;
border-radius: 11px;
background: var(--yse-accent);
color: #fff;
font-size: 15px;
font-weight: 600;
font-family: inherit;
cursor: pointer;
transition: filter 0.15s;
}
.yse-cta:hover {
filter: brightness(0.94);
}
.yse-cta:disabled {
background: #cfc8c2;
cursor: not-allowed;
}
.yse-open {
padding: 13px 24px;
}
.yse-full {
width: 100%;
padding: 14px;
margin-top: 6px;
}
.yse-bform {
display: none;
margin-top: 18px;
padding-top: 18px;
border-top: 1px dashed var(--yse-line);
}
.yse-bform.yse-open {
display: block;
}
.yse-frow {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 12px;
}
.yse-field {
margin-bottom: 12px;
}
.yse-field label {
display: block;
font-size: 13px;
font-weight: 600;
color: var(--yse-ink);
margin-bottom: 5px;
}
.yse-field input {
width: 100%;
border: 1px solid var(--yse-line);
border-radius: 10px;
padding: 11px 13px;
font-size: 15px;
font-family: inherit;
background: #fff;
color: var(--yse-ink);
}
.yse-field input:focus {
outline: none;
border-color: var(--yse-accent);
box-shadow: 0 0 0 3px color-mix(in srgb, var(--yse-accent) 22%, white);
}
.yse-consent {
font-size: 13px;
color: #4a433d;
display: flex;
gap: 9px;
align-items: flex-start;
margin-bottom: 9px;
}
.yse-consent input {
margin-top: 3px;
}
.yse-hp {
position: absolute !important;
left: -9999px !important;
width: 1px;
height: 1px;
}
.yse-error {
color: #c0392b;
font-size: 13px;
margin-top: 8px;
min-height: 18px;
}
.yse-done {
text-align: center;
padding: 8px 4px;
}
.yse-done .yse-ok {
width: 52px;
height: 52px;
border-radius: 50%;
background: var(--yse-accent);
color: #fff;
display: flex;
align-items: center;
justify-content: center;
margin: 0 auto 10px;
}
.yse-done h3 {
margin: 0 0 6px;
font-family: "Fraunces", serif;
}
.yse-done p {
color: #4a433d;
font-size: 14px;
margin: 2px 0;
}
.yse-widget .yse-booking { padding: 22px 26px; border-top: 1px solid var(--yse-line); }
.yse-widget .yse-soldout { text-align: center; font-weight: 600; color: #c0392b; }
.yse-widget .yse-wl-banner { background: color-mix(in srgb, var(--yse-accent) 12%, white); color: var(--yse-accent-ink); border-radius: 12px; padding: 12px 14px; font-size: 13.5px; margin-bottom: 16px; }
.yse-widget .yse-bcompact { display: flex; align-items: flex-end; gap: 22px; flex-wrap: wrap; }
.yse-widget .yse-btitle { font-family: inherit; font-weight: 600; font-size: 19px; color: var(--yse-ink); margin-right: auto; align-self: center; }
.yse-widget .yse-lbl { font-size: 12px; color: var(--yse-muted); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 5px; }
.yse-widget .yse-stepper { display: flex; align-items: center; border: 1px solid var(--yse-line); border-radius: 11px; overflow: hidden; background: #fff; }
.yse-widget .yse-stepper button { background: #fff !important; width: 44px; height: 46px; font-size: 22px; color: var(--yse-accent-ink) !important; cursor: pointer; }
.yse-widget .yse-stepper button:disabled { color: #cfc8c2 !important; cursor: not-allowed; }
.yse-widget .yse-num { width: 54px; text-align: center; font-size: 17px; font-weight: 600; }
.yse-widget .yse-total .yse-val { font-family: inherit; font-size: 26px; font-weight: 600; color: var(--yse-accent-ink); }
.yse-widget .yse-cta { background: var(--yse-accent) !important; color: #fff !important; font-size: 15px; font-weight: 600; border-radius: 11px; cursor: pointer; transition: filter .15s; }
.yse-widget .yse-cta:hover { filter: brightness(.94) !important; }
.yse-widget .yse-cta:disabled { background: #cfc8c2 !important; cursor: not-allowed; }
.yse-widget .yse-open { padding: 14px 26px; }
.yse-widget .yse-full { width: 100%; padding: 15px; margin-top: 6px; }
.yse-widget .yse-bform { display: none; margin-top: 20px; padding-top: 20px; border-top: 1px dashed var(--yse-line); }
.yse-widget .yse-bform.yse-open { display: block; }
.yse-widget .yse-frow { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.yse-widget .yse-field { margin-bottom: 12px; }
.yse-widget .yse-field label { display: block; font-size: 13px; font-weight: 600; color: var(--yse-ink); margin-bottom: 5px; }
.yse-widget .yse-field input { border: 1px solid var(--yse-line) !important; border-radius: 10px; padding: 12px 13px; font-size: 15px; background: #fff !important; color: var(--yse-ink) !important; }
.yse-widget .yse-field input:focus { outline: none; border-color: var(--yse-accent) !important; box-shadow: 0 0 0 3px color-mix(in srgb, var(--yse-accent) 22%, white) !important; }
.yse-widget .yse-consent { font-size: 13px; color: #4a433d; display: flex; gap: 9px; align-items: flex-start; margin-bottom: 9px; }
.yse-widget .yse-consent input { width: auto; margin-top: 3px; }
.yse-widget .yse-hp { position: absolute !important; left: -9999px !important; width: 1px !important; height: 1px !important; }
.yse-widget .yse-error { color: #c0392b; font-size: 13px; margin-top: 8px; min-height: 18px; }
.yse-widget .yse-done { text-align: center; padding: 10px 4px; }
.yse-widget .yse-done .yse-ok { width: 54px; height: 54px; border-radius: 50%; background: var(--yse-accent); color: #fff; display: flex; align-items: center; justify-content: center; margin: 0 auto 12px; }
.yse-widget .yse-done h3 { margin: 0 0 6px; font-family: inherit; font-size: 21px; }
.yse-widget .yse-done p { color: #4a433d; font-size: 14px; margin: 2px 0; }
/* Lightbox */
.yse-lightbox {
position: fixed;
inset: 0;
background: rgba(24, 19, 16, 0.9);
display: none;
align-items: center;
justify-content: center;
z-index: 99999;
padding: 24px;
}
.yse-lightbox.yse-open {
display: flex;
}
.yse-lightbox img {
max-width: 92vw;
max-height: 86vh;
border-radius: 12px;
}
.yse-lightbox .yse-lbclose {
position: absolute;
top: 18px;
right: 22px;
color: #fff;
font-size: 34px;
cursor: pointer;
background: none;
border: none;
line-height: 1;
}
/* Lightbox (montato su <body>, fuori da .yse-widget) */
.yse-lightbox { position: fixed; inset: 0; background: rgba(24,19,16,.9); display: none; align-items: center; justify-content: center; z-index: 99999; padding: 24px; }
.yse-lightbox.yse-open { display: flex; }
.yse-lightbox img { max-width: 92vw; max-height: 86vh; border-radius: 12px; }
.yse-lightbox .yse-lbclose { position: absolute; top: 18px; right: 22px; color: #fff !important; font-size: 34px; cursor: pointer; background: none !important; border: none !important; line-height: 1; padding: 0; }
@media (max-width: 560px) {
.yse-hero {
height: 200px;
}
.yse-title-row h3 {
font-size: 19px;
}
.yse-frow {
grid-template-columns: 1fr;
}
.yse-btitle {
width: 100%;
margin-bottom: 4px;
}
}
@media (prefers-reduced-motion: reduce) {
.yse-widget * {
transition: none !important;
}
@media (max-width: 600px) {
.yse-widget .yse-hero { height: 210px; }
.yse-widget .yse-title-row h3 { font-size: 20px; }
.yse-widget .yse-frow { grid-template-columns: 1fr; }
.yse-widget .yse-btitle { width: 100%; margin-bottom: 4px; }
.yse-widget .yse-chead, .yse-widget .yse-booking, .yse-widget .yse-body { padding-left: 18px; padding-right: 18px; }
}
@media (prefers-reduced-motion: reduce) { .yse-widget * { transition: none !important; } }
/* Miniatura copertina nella testata compatta */
.yse-widget .yse-thumb { width: 76px; height: 76px; border-radius: 12px; object-fit: cover; flex-shrink: 0; }
@media (max-width: 600px) { .yse-widget .yse-thumb { width: 60px; height: 60px; } }
/* Evento programmato (prenotazioni non ancora aperte) */
.yse-widget .yse-scheduled { text-align: center; font-weight: 600; color: var(--yse-accent-ink); background: color-mix(in srgb, var(--yse-accent) 12%, white); border-radius: 12px; padding: 12px 14px; }
+35 -34
View File
@@ -1,5 +1,4 @@
<?php
/**
* Plugin Name: YogaSoul Eventi
* Description: Mostra gli eventi di YogiBook con card di prenotazione (lista d'attesa inclusa). Shortcode: [yogasoul_eventi], [yogasoul_eventi ids="12,15"], [yogasoul_eventi id="12"], [yogasoul_eventi limit="3"].
@@ -19,15 +18,10 @@ if (!defined('YSE_API_BASE')) {
define('YSE_API_BASE', 'https://yogibook.yogasoul.it/apiwp');
}
/* Registra gli asset (accodati solo quando lo shortcode è in pagina) */
/* Registra gli asset (accodati solo quando lo shortcode è in pagina).
Nessun Google Font: il widget eredita il carattere del tema. */
add_action('wp_enqueue_scripts', function () {
wp_register_style(
'yse-fonts',
'https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,500;9..144,600&family=Inter:wght@400;500;600&display=swap',
[],
null
);
wp_register_style('yse-eventi', plugins_url('assets/yogasoul-eventi.css', __FILE__), ['yse-fonts'], '1.0.0');
wp_register_style('yse-eventi', plugins_url('assets/yogasoul-eventi.css', __FILE__), [], '1.0.1');
wp_register_script('yse-eventi', plugins_url('assets/yogasoul-eventi.js', __FILE__), [], '1.0.0', true);
});
@@ -60,8 +54,11 @@ function yse_render_shortcode($atts)
}
$url = YSE_API_BASE . '/events.php' . (!empty($query) ? '?' . http_build_query($query) : '');
// Lettura server-side (niente CORS)
$resp = wp_remote_get($url, ['timeout' => 8]);
// Lettura server-side (niente CORS) + anti-cache
$resp = wp_remote_get($url . (strpos($url, '?') !== false ? '&' : '?') . '_=' . time(), [
'timeout' => 8,
'headers' => ['Cache-Control' => 'no-cache'],
]);
if (is_wp_error($resp) || (int) wp_remote_retrieve_response_code($resp) !== 200) {
return '<div class="yse-widget"><p class="yse-empty">Eventi non disponibili al momento.</p></div>';
}
@@ -136,13 +133,13 @@ function yse_render_card($ev)
|| !empty($ev['cover_image']) || !empty($gallery) || $mapQuery !== '';
ob_start();
?>
?>
<div class="yse-card" style="--yse-accent: <?php echo esc_attr($color); ?>;"
data-eid="<?php echo $id; ?>"
data-cost="<?php echo esc_attr($cost); ?>"
data-sym="<?php echo esc_attr($sym); ?>"
data-maxqty="<?php echo (int) $maxQty; ?>"
data-waitmode="<?php echo $waitMode ? 1 : 0; ?>">
data-eid="<?php echo $id; ?>"
data-cost="<?php echo esc_attr($cost); ?>"
data-sym="<?php echo esc_attr($sym); ?>"
data-maxqty="<?php echo (int) $maxQty; ?>"
data-waitmode="<?php echo $waitMode ? 1 : 0; ?>">
<!-- HEADER COMPATTO -->
<div class="yse-chead">
@@ -150,6 +147,9 @@ function yse_render_card($ev)
<div class="yse-m"><?php echo esc_html($monAbbr); ?></div>
<div class="yse-d"><?php echo $dayNum; ?></div>
</div>
<?php if (!empty($ev['cover_image'])) : ?>
<img class="yse-thumb" src="<?php echo esc_url($ev['cover_image']); ?>" alt="<?php echo esc_attr($ev['title']); ?>">
<?php endif; ?>
<div class="yse-main">
<div class="yse-title-row">
<h3><?php echo esc_html($ev['title']); ?></h3>
@@ -188,22 +188,13 @@ function yse_render_card($ev)
<?php if (trim((string) ($ev['suitable_for'] ?? '')) !== '' || trim((string) ($ev['what_to_bring'] ?? '')) !== '' || trim((string) ($ev['instructions'] ?? '')) !== '') : ?>
<div class="yse-detail-grid">
<?php if (trim((string) ($ev['suitable_for'] ?? '')) !== '') : ?>
<div class="yse-detail">
<div class="yse-dh"><?php echo yse_icon('heart'); ?> Per chi è adatto</div>
<div class="yse-dt"><?php echo nl2br(esc_html($ev['suitable_for'])); ?></div>
</div>
<div class="yse-detail"><div class="yse-dh"><?php echo yse_icon('heart'); ?> Per chi è adatto</div><div class="yse-dt"><?php echo nl2br(esc_html($ev['suitable_for'])); ?></div></div>
<?php endif; ?>
<?php if (trim((string) ($ev['what_to_bring'] ?? '')) !== '') : ?>
<div class="yse-detail">
<div class="yse-dh"><?php echo yse_icon('bag'); ?> Cosa portare</div>
<div class="yse-dt"><?php echo nl2br(esc_html($ev['what_to_bring'])); ?></div>
</div>
<div class="yse-detail"><div class="yse-dh"><?php echo yse_icon('bag'); ?> Cosa portare</div><div class="yse-dt"><?php echo nl2br(esc_html($ev['what_to_bring'])); ?></div></div>
<?php endif; ?>
<?php if (trim((string) ($ev['instructions'] ?? '')) !== '') : ?>
<div class="yse-detail">
<div class="yse-dh"><?php echo yse_icon('info'); ?> Istruzioni</div>
<div class="yse-dt"><?php echo nl2br(esc_html($ev['instructions'])); ?></div>
</div>
<div class="yse-detail"><div class="yse-dh"><?php echo yse_icon('info'); ?> Istruzioni</div><div class="yse-dt"><?php echo nl2br(esc_html($ev['instructions'])); ?></div></div>
<?php endif; ?>
</div>
<?php endif; ?>
@@ -231,11 +222,21 @@ function yse_render_card($ev)
<!-- BOOKING -->
<div class="yse-booking">
<?php if ($hardFull) : ?>
<?php if (!empty($ev['scheduled'])) :
$pt = !empty($ev['publish_at']) ? strtotime($ev['publish_at']) : 0;
$ptLabel = $pt ? ((int) date('j', $pt) . ' ' . $mesi[(int) date('n', $pt)] . ' ' . date('Y', $pt) . ' alle ' . date('H:i', $pt)) : '';
?>
<div class="yse-scheduled">Prenotazioni aperte dal <strong><?php echo esc_html($ptLabel); ?></strong></div>
<?php elseif ($hardFull) : ?>
<div class="yse-soldout">Evento esaurito — non ci sono più posti disponibili.</div>
<?php else : ?>
<?php if ($waitMode) : ?>
<div class="yse-wl-banner">Posti esauriti — puoi iscriverti alla <strong>lista d'attesa</strong>: ti avviseremo se si libera un posto.</div>
<?php if ($waitMode) :
$waitingCount = (int) ($ev['waiting'] ?? 0);
$waitingTxt = $waitingCount > 0
? ' Al momento ' . ($waitingCount === 1 ? "c'è 1 persona" : "ci sono {$waitingCount} persone") . ' in coda.'
: '';
?>
<div class="yse-wl-banner">Posti esauriti — puoi iscriverti alla <strong>lista d'attesa</strong>: ti avviseremo se si libera un posto.<?php echo esc_html($waitingTxt); ?></div>
<?php endif; ?>
<div class="yse-bcompact">
<div class="yse-btitle"><?php echo $waitMode ? "Lista d'attesa" : 'Prenota questo evento'; ?></div>
@@ -270,6 +271,6 @@ function yse_render_card($ev)
<?php endif; ?>
</div>
</div>
<?php
<?php
return ob_get_clean();
}
}