feat: add wordpress site variant

This commit is contained in:
bisco
2026-06-25 07:36:25 +02:00
parent cae9180bc6
commit c66dd7e511
46 changed files with 2091 additions and 136 deletions
+161
View File
@@ -0,0 +1,161 @@
<?php
/**
* Azione!Lab theme setup and editable homepage fields.
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
function azionelab_defaults(): array {
return array(
'hero_title' => 'Il teatro diventa presenza.',
'hero_subtitle' => 'Un laboratorio dove corpo, voce, ascolto e relazione diventano scena.',
'hero_primary_label' => 'Vieni a conoscerci',
'hero_secondary_label'=> 'Guarda la galleria',
'intro_title' => 'Uno spazio per esserci davvero',
'intro_body' => 'Ogni incontro è uno spazio di pratica: si prova, si sbaglia, si ascolta, si ricomincia. Il gruppo diventa materia viva, la scena diventa occasione di scoperta.',
'laboratory_title' => 'Il laboratorio',
'laboratory_body' => 'Lavoriamo con il corpo, la voce e limprovvisazione per allenare ascolto e presenza scenica. Attraverso esercizi individuali e di gruppo, ogni persona trova un modo autentico di stare nello spazio e nella relazione.',
'teacher_name' => 'Ernesto Estatico',
'teacher_bio' => 'Attore, regista e formatore, accompagna gruppi di ogni esperienza con cura e concretezza. Da oltre quindici anni conduce percorsi dedicati alla ricerca dellautenticità scenica, intrecciando pedagogia teatrale, movimento e lavoro sulla voce.',
'teacher_quote' => 'Il teatro non è fingere: è imparare a essere presenti.',
'lesson_schedule' => 'Ogni martedì, dalle 20:00 alle 22:30',
'lesson_location' => "Spazio Teatro, Via dell'Epomeo 9999, Napoli",
'lesson_audience' => 'Adulti, con o senza esperienza',
'lesson_description' => 'Training fisico e vocale, improvvisazione, ascolto, costruzione del personaggio e lavoro di scena.',
'trial_lesson' => 'La prima lezione di prova è gratuita, su prenotazione.',
'lesson_notes' => 'Abiti comodi e calze antiscivolo consigliati.',
'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_address' => "Via dell'Epomeo 9999, Napoli",
'footer_text' => 'Uno spazio aperto a chi desidera incontrare il teatro, insieme.',
);
}
function azionelab_mod( string $key ): string {
$defaults = azionelab_defaults();
return (string) get_theme_mod( $key, $defaults[ $key ] ?? '' );
}
function azionelab_asset( string $filename ): string {
return get_theme_file_uri( 'assets/images/' . $filename );
}
function azionelab_phone_href( string $number ): string {
return preg_replace( '/[^0-9+]/', '', $number ) ?: '';
}
function azionelab_whatsapp_href( string $number ): string {
return preg_replace( '/[^0-9]/', '', $number ) ?: '';
}
function azionelab_setup(): void {
load_theme_textdomain( 'azionelab', get_template_directory() . '/languages' );
add_theme_support( 'title-tag' );
add_theme_support( 'post-thumbnails' );
add_theme_support( 'responsive-embeds' );
add_theme_support(
'html5',
array( 'search-form', 'comment-form', 'comment-list', 'gallery', 'caption', 'style', 'script' )
);
}
add_action( 'after_setup_theme', 'azionelab_setup' );
function azionelab_assets(): void {
wp_enqueue_style( 'azionelab', get_stylesheet_uri(), array(), '1.0.0' );
}
add_action( 'wp_enqueue_scripts', 'azionelab_assets' );
function azionelab_customize_register( WP_Customize_Manager $customizer ): void {
$defaults = azionelab_defaults();
$sections = array(
'azionelab_hero' => array( 'Hero', 30 ),
'azionelab_intro' => array( 'Manifesto e laboratorio', 31 ),
'azionelab_teacher' => array( 'Il maestro', 32 ),
'azionelab_lessons' => array( 'Le lezioni', 33 ),
'azionelab_contacts' => array( 'Contatti e footer', 34 ),
);
foreach ( $sections as $id => $section ) {
$customizer->add_section(
$id,
array( 'title' => $section[0], 'priority' => $section[1] )
);
}
$fields = array(
'hero_title' => array( 'azionelab_hero', 'Titolo', 'text' ),
'hero_subtitle' => array( 'azionelab_hero', 'Sottotitolo', 'textarea' ),
'hero_image' => array( 'azionelab_hero', 'Immagine principale', 'image' ),
'hero_primary_label' => array( 'azionelab_hero', 'Etichetta CTA primaria', 'text' ),
'hero_secondary_label' => array( 'azionelab_hero', 'Etichetta CTA secondaria', 'text' ),
'intro_title' => array( 'azionelab_intro', 'Titolo manifesto', 'text' ),
'intro_body' => array( 'azionelab_intro', 'Testo manifesto', 'textarea_html' ),
'laboratory_title' => array( 'azionelab_intro', 'Titolo laboratorio', 'text' ),
'laboratory_body' => array( 'azionelab_intro', 'Descrizione laboratorio', 'textarea_html' ),
'laboratory_image' => array( 'azionelab_intro', 'Immagine laboratorio', 'image' ),
'teacher_name' => array( 'azionelab_teacher', 'Nome', 'text' ),
'teacher_bio' => array( 'azionelab_teacher', 'Biografia', 'textarea_html' ),
'teacher_quote' => array( 'azionelab_teacher', 'Citazione', 'textarea' ),
'teacher_image' => array( 'azionelab_teacher', 'Foto', 'image' ),
'lesson_schedule' => array( 'azionelab_lessons', 'Quando', 'text' ),
'lesson_location' => array( 'azionelab_lessons', 'Dove', 'text' ),
'lesson_audience' => array( 'azionelab_lessons', 'Per chi', 'text' ),
'lesson_description' => array( 'azionelab_lessons', 'Cosa si fa', 'textarea_html' ),
'trial_lesson' => array( 'azionelab_lessons', 'Lezione di prova', 'text' ),
'lesson_notes' => array( 'azionelab_lessons', 'Note', 'textarea' ),
'contact_email' => array( 'azionelab_contacts', 'Email', 'email' ),
'contact_phone' => array( 'azionelab_contacts', 'Telefono', 'text' ),
'contact_whatsapp' => array( 'azionelab_contacts', 'WhatsApp', 'text' ),
'contact_instagram' => array( 'azionelab_contacts', 'Instagram', 'url' ),
'contact_facebook' => array( 'azionelab_contacts', 'Facebook', 'url' ),
'contact_address' => array( 'azionelab_contacts', 'Indirizzo', 'text' ),
'footer_text' => array( 'azionelab_contacts', 'Testo footer', 'text' ),
);
foreach ( $fields as $id => $field ) {
$type = $field[2];
$sanitize_callback = 'sanitize_text_field';
if ( 'textarea' === $type ) {
$sanitize_callback = 'sanitize_textarea_field';
} elseif ( 'textarea_html' === $type ) {
$sanitize_callback = 'wp_kses_post';
} elseif ( 'email' === $type ) {
$sanitize_callback = 'sanitize_email';
} elseif ( 'url' === $type || 'image' === $type ) {
$sanitize_callback = 'esc_url_raw';
}
$customizer->add_setting(
$id,
array(
'default' => $defaults[ $id ] ?? '',
'sanitize_callback' => $sanitize_callback,
)
);
if ( 'image' === $type ) {
$customizer->add_control(
new WP_Customize_Image_Control(
$customizer,
$id,
array( 'label' => $field[1], 'section' => $field[0] )
)
);
} else {
$customizer->add_control(
$id,
array(
'label' => $field[1],
'section' => $field[0],
'type' => str_starts_with( $type, 'textarea' ) ? 'textarea' : $type,
)
);
}
}
}
add_action( 'customize_register', 'azionelab_customize_register' );