fix: expose show card description field

This commit is contained in:
bisco
2026-06-25 17:23:26 +02:00
parent 4849b26232
commit f49026b317
3 changed files with 21 additions and 1 deletions
+2 -1
View File
@@ -148,7 +148,8 @@ uses different host paths or image user IDs.
- **Appearance > Customize**: hero, manifesto, laboratory, teacher, lessons, contacts,
social links, and footer.
- **Shows**: poster, title, excerpt, year, place, and order.
- **Shows**: poster, title, short description, year, place, and order. The short
description is the **Descrizione breve** field inside **Dettagli spettacolo**.
- **Gallery**: image, category, caption/title, and order.
- **Settings > General**: site name and tagline.
+5
View File
@@ -48,6 +48,11 @@ HTTPS redirects during production startup.
4. Confirm the uploaded file exists under `WORDPRESS_DATA_PATH/wp-content/uploads` and
is readable by the WordPress container user.
## Show card description is hard to find
Edit **Spettacoli**, open the show, then use **Dettagli spettacolo > Descrizione
breve**. That field is rendered below the title in the homepage show card.
## A service cannot write to its volume
1. Stop the affected service.
@@ -58,6 +58,11 @@ function azionelab_show_meta_box( WP_Post $post ): void {
$year = get_post_meta( $post->ID, 'azl_show_year', true );
$location = get_post_meta( $post->ID, 'azl_show_location', true );
?>
<p>
<label for="azl_show_excerpt"><strong>Descrizione breve</strong></label><br>
<textarea id="azl_show_excerpt" name="azl_show_excerpt" class="widefat" rows="4"><?php echo esc_textarea( $post->post_excerpt ); ?></textarea>
<span class="description">Questo testo appare nella card dello spettacolo in homepage.</span>
</p>
<p><label for="azl_show_year"><strong>Anno</strong></label><br><input id="azl_show_year" name="azl_show_year" type="number" min="1900" max="2100" value="<?php echo esc_attr( $year ); ?>"></p>
<p><label for="azl_show_location"><strong>Luogo</strong></label><br><input id="azl_show_location" name="azl_show_location" type="text" class="widefat" value="<?php echo esc_attr( $location ); ?>"></p>
<?php
@@ -90,10 +95,19 @@ function azionelab_save_meta( int $post_id ): void {
$post_type = get_post_type( $post_id );
if ( 'azl_show' === $post_type ) {
$excerpt = isset( $_POST['azl_show_excerpt'] ) ? sanitize_textarea_field( wp_unslash( $_POST['azl_show_excerpt'] ) ) : '';
$year = isset( $_POST['azl_show_year'] ) ? absint( $_POST['azl_show_year'] ) : 0;
$location = isset( $_POST['azl_show_location'] ) ? sanitize_text_field( wp_unslash( $_POST['azl_show_location'] ) ) : '';
update_post_meta( $post_id, 'azl_show_year', $year );
update_post_meta( $post_id, 'azl_show_location', $location );
remove_action( 'save_post', 'azionelab_save_meta' );
wp_update_post(
array(
'ID' => $post_id,
'post_excerpt' => $excerpt,
)
);
add_action( 'save_post', 'azionelab_save_meta' );
} elseif ( 'azl_gallery' === $post_type ) {
$allowed = array( 'Lezioni', 'Backstage', 'Spettacoli', 'Gruppo' );
$category = isset( $_POST['azl_gallery_category'] ) ? sanitize_text_field( wp_unslash( $_POST['azl_gallery_category'] ) ) : '';