Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| ea5ecafc3d | |||
| 696934016f | |||
| 06d7057e76 | |||
| ef2978fc21 | |||
| 587b10c2b3 | |||
| 754915b91f |
@@ -407,14 +407,22 @@ traducción inmediata, avisar a Rafa directamente además de pedírselo a Hermes
|
|||||||
| Asignar `_carta_id` a un artículo | `POST /wp-json/fea/v1/carta-id/{id}` con body `{"carta_id": N}` |
|
| Asignar `_carta_id` a un artículo | `POST /wp-json/fea/v1/carta-id/{id}` con body `{"carta_id": N}` |
|
||||||
| Borrar `_carta_id` de un artículo | `DELETE /wp-json/fea/v1/carta-id/{id}` |
|
| Borrar `_carta_id` de un artículo | `DELETE /wp-json/fea/v1/carta-id/{id}` |
|
||||||
|
|
||||||
## Regla para la sección Evangelio y comentarios al Evangelio
|
## Evangelio y comentarios: regla y paso obligatorio para Mixbot
|
||||||
|
|
||||||
La sección empieza siempre con el enlace al post del evangelio de esa semana (por
|
La sección empieza siempre con el enlace al post del evangelio de esa semana (por
|
||||||
ejemplo, `MATEO 14, 22-33`) y después van los comentarios. Si ese post no existe,
|
ejemplo, `MATEO 14, 22-33`) y después van los comentarios. Si ese post no existe,
|
||||||
avisad antes de publicar la carta: no empecéis la sección por un comentario.
|
avisad antes de publicar la carta: no empecéis la sección por un comentario.
|
||||||
|
|
||||||
No hay que completar ningún campo nuevo. A partir de ese enlace, el sitio asigna la
|
Primero guarda la carta (puede quedar como borrador) con esa sección ya completa y
|
||||||
cita bíblica automáticamente a los comentarios nuevos.
|
anota su ID. Después asigna ese ID a **cada comentario al evangelio** de la semana con
|
||||||
|
el endpoint `POST /wp-json/fea/v1/carta-id/<id-del-comentario>` y el cuerpo
|
||||||
|
`{"carta_id": <id-de-la-carta>}`.
|
||||||
|
|
||||||
|
No hay que escribir la cita ni el texto bíblico a mano: al asignar `_carta_id`, el
|
||||||
|
plugin localiza la única lectura bíblica enlazada en la sección y añade
|
||||||
|
`_cita_evangelio` automáticamente, incluso si el comentario ya estaba publicado. Si
|
||||||
|
la carta tiene cero o varias lecturas, el plugin no adivina: corrige la sección y
|
||||||
|
vuelve a asignar el ID de carta.
|
||||||
|
|
||||||
Campos útiles del post: `title`, `content` (HTML), `status` (`draft`/`publish`/`future`),
|
Campos útiles del post: `title`, `content` (HTML), `status` (`draft`/`publish`/`future`),
|
||||||
`date` (ISO 8601 para programar), `categories` (array de IDs), `featured_media` (ID de adjunto).
|
`date` (ISO 8601 para programar), `categories` (array de IDs), `featured_media` (ID de adjunto).
|
||||||
|
|||||||
@@ -84,14 +84,6 @@ add_action('wp_head', function () {
|
|||||||
}
|
}
|
||||||
#fea-theme-btn:hover { background: rgba(0,0,0,0.06); }
|
#fea-theme-btn:hover { background: rgba(0,0,0,0.06); }
|
||||||
|
|
||||||
/* La luna debe destacar también sobre cabeceras claras. */
|
|
||||||
html:not([data-fea-theme="dark"]) #fea-theme-btn {
|
|
||||||
background: #000;
|
|
||||||
border-color: #000;
|
|
||||||
color: #f6c744;
|
|
||||||
}
|
|
||||||
html:not([data-fea-theme="dark"]) #fea-theme-btn:hover { background: #242424; }
|
|
||||||
|
|
||||||
/* ══════════════════════════════════════════════════════════════════
|
/* ══════════════════════════════════════════════════════════════════
|
||||||
MODO OSCURO — activado por [data-fea-theme="dark"] en <html>
|
MODO OSCURO — activado por [data-fea-theme="dark"] en <html>
|
||||||
══════════════════════════════════════════════════════════════════ */
|
══════════════════════════════════════════════════════════════════ */
|
||||||
|
|||||||
@@ -9,8 +9,12 @@ function fea_evangelio_category($es_id) {
|
|||||||
return function_exists('fea_cat') ? (int) fea_cat($es_id) : (int) $es_id;
|
return function_exists('fea_cat') ? (int) fea_cat($es_id) : (int) $es_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function fea_evangelio_comment_categories() {
|
||||||
|
return array_map('fea_evangelio_category', [1647, 1646]);
|
||||||
|
}
|
||||||
|
|
||||||
function fea_evangelio_is_comment($post_id) {
|
function fea_evangelio_is_comment($post_id) {
|
||||||
return has_category(fea_evangelio_category(1647), $post_id);
|
return has_category(fea_evangelio_comment_categories(), $post_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Lee el meta del comentario; las traducciones heredan el dato editorial del original ES. */
|
/** Lee el meta del comentario; las traducciones heredan el dato editorial del original ES. */
|
||||||
@@ -122,6 +126,14 @@ add_action('transition_post_status', function($new_status, $old_status, $post) {
|
|||||||
if ($new_status === 'publish' && $old_status !== 'publish') fea_evangelio_capture_meta($post->ID);
|
if ($new_status === 'publish' && $old_status !== 'publish') fea_evangelio_capture_meta($post->ID);
|
||||||
}, 20, 3);
|
}, 20, 3);
|
||||||
|
|
||||||
|
/** Completa la cita cuando llega la carta, aunque el comentario ya estuviera publicado. */
|
||||||
|
function fea_evangelio_capture_meta_on_carta_assignment($meta_id, $post_id, $meta_key, $meta_value) {
|
||||||
|
if ($meta_key !== '_carta_id' || !(int) $meta_value) return;
|
||||||
|
fea_evangelio_capture_meta((int) $post_id);
|
||||||
|
}
|
||||||
|
add_action('added_post_meta', 'fea_evangelio_capture_meta_on_carta_assignment', 20, 4);
|
||||||
|
add_action('updated_post_meta', 'fea_evangelio_capture_meta_on_carta_assignment', 20, 4);
|
||||||
|
|
||||||
/** Añade referencia y texto plegado, cerrado por defecto, antes del comentario. */
|
/** Añade referencia y texto plegado, cerrado por defecto, antes del comentario. */
|
||||||
add_filter('the_content', function($content) {
|
add_filter('the_content', function($content) {
|
||||||
if (!is_single() || is_admin()) return $content;
|
if (!is_single() || is_admin()) return $content;
|
||||||
|
|||||||
@@ -2,10 +2,14 @@
|
|||||||
/** Propuesta/aplicación segura del backfill de _cita_evangelio. */
|
/** Propuesta/aplicación segura del backfill de _cita_evangelio. */
|
||||||
/** Uso: wp eval-file scripts/backfill_evangelio_meta.php [--apply] --path=/var/www/html */
|
/** Uso: wp eval-file scripts/backfill_evangelio_meta.php [--apply] --path=/var/www/html */
|
||||||
|
|
||||||
$apply = in_array('--apply', $_SERVER['argv'] ?? [], true);
|
// WP-CLI no reenvía de forma consistente argumentos desconocidos a eval-file.
|
||||||
|
// El modo escritura exige por tanto una intención explícita y auditable:
|
||||||
|
// FEA_EVANGELIO_APPLY=1 wp eval-file scripts/backfill_evangelio_meta.php
|
||||||
|
$apply = getenv('FEA_EVANGELIO_APPLY') === '1'
|
||||||
|
|| in_array('--apply', $_SERVER['argv'] ?? [], true);
|
||||||
$posts = get_posts([
|
$posts = get_posts([
|
||||||
'post_type' => 'post', 'post_status' => 'publish', 'posts_per_page' => -1,
|
'post_type' => 'post', 'post_status' => 'publish', 'posts_per_page' => -1,
|
||||||
'category__in' => [fea_evangelio_category(1647)],
|
'category__in' => fea_evangelio_comment_categories(),
|
||||||
'meta_query' => [['key' => '_cita_evangelio', 'compare' => 'NOT EXISTS']],
|
'meta_query' => [['key' => '_cita_evangelio', 'compare' => 'NOT EXISTS']],
|
||||||
'orderby' => 'date', 'order' => 'ASC',
|
'orderby' => 'date', 'order' => 'ASC',
|
||||||
]);
|
]);
|
||||||
|
|||||||
Reference in New Issue
Block a user