fix: harden WordPress content rendering

This commit is contained in:
bisco
2026-06-26 15:54:57 +02:00
parent 482928a296
commit 0762b98fc6
8 changed files with 43 additions and 18 deletions
+9 -6
View File
@@ -19,12 +19,15 @@ function azionelab_register_content_types(): void {
'add_new_item' => 'Aggiungi spettacolo',
'edit_item' => 'Modifica spettacolo',
),
'public' => true,
'show_in_rest' => false,
'menu_icon' => 'dashicons-tickets-alt',
'supports' => array( 'title', 'editor', 'excerpt', 'thumbnail', 'page-attributes' ),
'has_archive' => false,
'rewrite' => false,
'public' => false,
'show_ui' => true,
'publicly_queryable' => false,
'exclude_from_search'=> true,
'show_in_rest' => false,
'menu_icon' => 'dashicons-tickets-alt',
'supports' => array( 'title', 'editor', 'excerpt', 'thumbnail', 'page-attributes' ),
'has_archive' => false,
'rewrite' => false,
)
);
+15 -4
View File
@@ -21,6 +21,11 @@ $social_links = array_values(
static fn ( array $link ): bool => '' !== $link['url']
)
);
$contact_email = sanitize_email( azionelab_mod( 'contact_email' ) );
$contact_phone = trim( azionelab_mod( 'contact_phone' ) );
$contact_phone_href = azionelab_phone_href( $contact_phone );
$contact_whatsapp = trim( azionelab_mod( 'contact_whatsapp' ) );
$contact_whatsapp_href = azionelab_whatsapp_href( $contact_whatsapp );
?>
<main id="contenuto">
<section class="hero section" id="inizio" aria-labelledby="hero-title">
@@ -135,7 +140,7 @@ $social_links = array_values(
?>
<article class="show-card">
<img src="<?php echo esc_url( $image ); ?>" alt="Locandina di <?php the_title_attribute(); ?>" width="700" height="880" loading="lazy">
<div class="show-copy"><?php if ( $show_meta ) : ?><p class="show-meta"><?php echo esc_html( $show_meta ); ?></p><?php endif; ?><h3><?php the_title(); ?></h3><div><?php the_excerpt(); ?></div></div>
<div class="show-copy"><?php if ( $show_meta ) : ?><p class="show-meta"><?php echo esc_html( $show_meta ); ?></p><?php endif; ?><h3><?php echo esc_html( get_the_title() ); ?></h3><div><?php echo wp_kses_post( wpautop( get_the_excerpt() ) ); ?></div></div>
</article>
<?php
++$show_index;
@@ -207,9 +212,15 @@ $social_links = array_values(
<?php endif; ?>
</div>
<div class="contact-actions">
<a class="contact-action" href="mailto:<?php echo esc_attr( sanitize_email( azionelab_mod( 'contact_email' ) ) ); ?>"><?php echo azionelab_contact_icon( 'email' ); ?><span>Scrivi una mail</span><strong><?php echo esc_html( azionelab_mod( 'contact_email' ) ); ?></strong></a>
<a class="contact-action" href="tel:<?php echo esc_attr( azionelab_phone_href( azionelab_mod( 'contact_phone' ) ) ); ?>"><?php echo azionelab_contact_icon( 'phone' ); ?><span>Chiama</span><strong><?php echo esc_html( azionelab_mod( 'contact_phone' ) ); ?></strong></a>
<a class="contact-action" href="https://wa.me/<?php echo esc_attr( azionelab_whatsapp_href( azionelab_mod( 'contact_whatsapp' ) ) ); ?>" rel="noopener noreferrer"><?php echo azionelab_contact_icon( 'whatsapp' ); ?><span>WhatsApp</span><strong><?php echo esc_html( azionelab_mod( 'contact_whatsapp' ) ); ?></strong></a>
<?php if ( $contact_email ) : ?>
<a class="contact-action" href="mailto:<?php echo esc_attr( $contact_email ); ?>"><?php echo azionelab_contact_icon( 'email' ); ?><span>Scrivi una mail</span><strong><?php echo esc_html( $contact_email ); ?></strong></a>
<?php endif; ?>
<?php if ( $contact_phone && $contact_phone_href ) : ?>
<a class="contact-action" href="tel:<?php echo esc_attr( $contact_phone_href ); ?>"><?php echo azionelab_contact_icon( 'phone' ); ?><span>Chiama</span><strong><?php echo esc_html( $contact_phone ); ?></strong></a>
<?php endif; ?>
<?php if ( $contact_whatsapp && $contact_whatsapp_href ) : ?>
<a class="contact-action" href="https://wa.me/<?php echo esc_attr( $contact_whatsapp_href ); ?>" rel="noopener noreferrer"><?php echo azionelab_contact_icon( 'whatsapp' ); ?><span>WhatsApp</span><strong><?php echo esc_html( $contact_whatsapp ); ?></strong></a>
<?php endif; ?>
</div>
</div>
</section>
+3 -3
View File
@@ -29,9 +29,9 @@ function azionelab_defaults(): array {
'contact_email' => 'ciao@azionelab.org',
'contact_phone' => '+39 333 123 4567',
'contact_whatsapp' => '+39 333 123 4567',
'contact_instagram' => 'https://instagram.com/',
'contact_facebook' => 'https://facebook.com/',
'contact_youtube' => 'https://youtube.com/',
'contact_instagram' => '',
'contact_facebook' => '',
'contact_youtube' => '',
'contact_address' => "Via dell'Epomeo 9999, Napoli",
'footer_text' => 'Uno spazio aperto a chi desidera incontrare il teatro, insieme.',
);