Finales felices (con revisión) y apadrinamiento, preparados y ocultos
- Formulario [ga_final_feliz]: las familias envían texto y foto (solo imágenes reales ≤5 MB, límite de envíos, consentimiento de publicación). Queda pendiente hasta que el equipo la publica; aviso por correo y contador en el menú. - Sección «Finales felices»: historias aprobadas o, si no hay, los adoptados. - Casilla «Busca padrino o madrina», sección «Apadrina» y motivo de contacto (sin pagos). - Páginas «Finales felices / Amaiera zoriontsuak» creadas como borrador. - API: profile.sponsorable. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
7
docker/content/es/finales-felices.html
Normal file
7
docker/content/es/finales-felices.html
Normal file
@@ -0,0 +1,7 @@
|
||||
<!-- wp:paragraph -->
|
||||
<p>¿Adoptaste a uno de nuestros animales? Nos encantará saber cómo está. Envíanos unas líneas y una foto: lo revisaremos antes de publicarlo.</p>
|
||||
<!-- /wp:paragraph -->
|
||||
|
||||
<!-- wp:shortcode -->
|
||||
[ga_final_feliz]
|
||||
<!-- /wp:shortcode -->
|
||||
7
docker/content/eu/amaiera-zoriontsuak.html
Normal file
7
docker/content/eu/amaiera-zoriontsuak.html
Normal file
@@ -0,0 +1,7 @@
|
||||
<!-- wp:paragraph -->
|
||||
<p>Gure animalietako bat adoptatu zenuen? Asko gustatuko litzaiguke nola dagoen jakitea. Bidali iezaguzu lerro batzuk eta argazki bat: argitaratu aurretik berrikusiko dugu.</p>
|
||||
<!-- /wp:paragraph -->
|
||||
|
||||
<!-- wp:shortcode -->
|
||||
[ga_final_feliz]
|
||||
<!-- /wp:shortcode -->
|
||||
@@ -79,7 +79,7 @@ function ga_setup_untouched( WP_Post $post ) {
|
||||
return $post->post_modified_gmt === $post->post_date_gmt;
|
||||
}
|
||||
|
||||
function ga_setup_page( $slug, $title, $file, $lang ) {
|
||||
function ga_setup_page( $slug, $title, $file, $lang, $status = 'publish' ) {
|
||||
$content = file_exists( $file ) ? file_get_contents( $file ) : '';
|
||||
$page = get_page_by_path( $slug, OBJECT, 'page' );
|
||||
|
||||
@@ -95,7 +95,7 @@ function ga_setup_page( $slug, $title, $file, $lang ) {
|
||||
} else {
|
||||
$id = wp_insert_post( array(
|
||||
'post_type' => 'page',
|
||||
'post_status' => 'publish',
|
||||
'post_status' => $status,
|
||||
'post_title' => $title,
|
||||
'post_name' => $slug,
|
||||
'post_content' => $content,
|
||||
@@ -147,6 +147,20 @@ foreach ( array( 'hotel', 'hotela' ) as $slug ) {
|
||||
}
|
||||
}
|
||||
|
||||
// Páginas preparadas pero sin publicar: el equipo las publica cuando quiera.
|
||||
$drafts = array( 'finales-felices' => array( 'Finales felices', 'amaiera-zoriontsuak', 'Amaiera zoriontsuak' ) );
|
||||
foreach ( $drafts as $slug => [ $title_es, $slug_eu, $title_eu ] ) {
|
||||
$exists = get_posts( array( 'post_type' => 'page', 'name' => $slug, 'post_status' => 'any', 'numberposts' => 1, 'lang' => '' ) );
|
||||
if ( $exists ) {
|
||||
continue;
|
||||
}
|
||||
$draft_ids = array( 'es' => ga_setup_page( $slug, $title_es, "$src/es/$slug.html", 'es', 'draft' ) );
|
||||
if ( $pll ) {
|
||||
$draft_ids['eu'] = ga_setup_page( $slug_eu, $title_eu, "$src/eu/$slug_eu.html", 'eu', 'draft' );
|
||||
pll_save_post_translations( $draft_ids );
|
||||
}
|
||||
}
|
||||
|
||||
update_option( 'show_on_front', 'page' );
|
||||
update_option( 'page_on_front', $ids['inicio']['es'] );
|
||||
update_option( 'wp_page_for_privacy_policy', $ids['politica-de-privacidad']['es'] );
|
||||
|
||||
Reference in New Issue
Block a user