Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| d208a2d935 |
@@ -924,6 +924,58 @@ function fea_is_front_page(): bool {
|
|||||||
return $id && in_array($id, fea_front_page_ids(), true);
|
return $id && in_array($id, fea_front_page_ids(), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** URL de la búsqueda avanzada en el idioma actual, con fallback al español. */
|
||||||
|
function fea_home_advanced_search_url(): string {
|
||||||
|
$url = home_url('/buscar/');
|
||||||
|
if (!function_exists('pll_current_language') || !function_exists('pll_get_post')) return $url;
|
||||||
|
|
||||||
|
$lang = pll_current_language();
|
||||||
|
$default = function_exists('pll_default_language') ? pll_default_language() : 'es';
|
||||||
|
if (!$lang || $lang === $default) return $url;
|
||||||
|
|
||||||
|
$page = get_page_by_path('buscar');
|
||||||
|
if (!$page) return $url;
|
||||||
|
|
||||||
|
$translated_id = pll_get_post($page->ID, $lang);
|
||||||
|
return $translated_id ? get_permalink($translated_id) : $url;
|
||||||
|
}
|
||||||
|
|
||||||
|
// En desktop, una lupa sin texto abre la búsqueda avanzada en vez de activar la
|
||||||
|
// validación nativa del campo requerido del bloque Search de WordPress.
|
||||||
|
add_action('wp_footer', function() {
|
||||||
|
if (!fea_is_front_page()) return;
|
||||||
|
$advanced_url = wp_json_encode(fea_home_advanced_search_url());
|
||||||
|
?>
|
||||||
|
<script>
|
||||||
|
(function() {
|
||||||
|
function configureDesktopSearch() {
|
||||||
|
if (!window.matchMedia('(min-width: 601px)').matches) return;
|
||||||
|
|
||||||
|
document.querySelectorAll('form.wp-block-search, .wp-block-search form').forEach(function(form) {
|
||||||
|
var input = form.querySelector('input[type="search"], input[name="s"]');
|
||||||
|
if (!input || form.dataset.feaEmptySearchReady) return;
|
||||||
|
|
||||||
|
form.dataset.feaEmptySearchReady = 'true';
|
||||||
|
form.noValidate = true;
|
||||||
|
input.removeAttribute('required');
|
||||||
|
form.addEventListener('submit', function(event) {
|
||||||
|
if (input.value.trim() !== '') return;
|
||||||
|
event.preventDefault();
|
||||||
|
window.location.assign(<?php echo $advanced_url; ?>);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (document.readyState === 'loading') {
|
||||||
|
document.addEventListener('DOMContentLoaded', configureDesktopSearch);
|
||||||
|
} else {
|
||||||
|
configureDesktopSearch();
|
||||||
|
}
|
||||||
|
})();
|
||||||
|
</script>
|
||||||
|
<?php
|
||||||
|
});
|
||||||
|
|
||||||
/** True para la landing de Escuela, que no muestra título visible. */
|
/** True para la landing de Escuela, que no muestra título visible. */
|
||||||
function fea_is_escuela_page(): bool {
|
function fea_is_escuela_page(): bool {
|
||||||
if (!is_page()) return false;
|
if (!is_page()) return false;
|
||||||
|
|||||||
@@ -324,8 +324,7 @@ def main() -> int:
|
|||||||
ids = [int(x) for x in Path(args.ids_file).read_text().split() if x.strip().isdigit()]
|
ids = [int(x) for x in Path(args.ids_file).read_text().split() if x.strip().isdigit()]
|
||||||
log(f"ids-file {args.ids_file}: {len(ids)} posts")
|
log(f"ids-file {args.ids_file}: {len(ids)} posts")
|
||||||
else:
|
else:
|
||||||
# La carta puede llevar _carta_id (p. ej. tras un sync); no la traduzcas dos veces.
|
ids = [args.carta] + carta_article_ids(args.carta)
|
||||||
ids = list(dict.fromkeys([args.carta] + carta_article_ids(args.carta)))
|
|
||||||
log(f"Carta {args.carta}: {len(ids)} posts (carta + {len(ids)-1} artículos)")
|
log(f"Carta {args.carta}: {len(ids)} posts (carta + {len(ids)-1} artículos)")
|
||||||
|
|
||||||
state = load_state()
|
state = load_state()
|
||||||
|
|||||||
@@ -20,8 +20,7 @@ sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
|
|||||||
import minimax_tts as mm # get_post_text, add_pauses, t2a, OUT
|
import minimax_tts as mm # get_post_text, add_pauses, t2a, OUT
|
||||||
import translate_post as tp # carta_article_ids
|
import translate_post as tp # carta_article_ids
|
||||||
|
|
||||||
# Voz de respaldo vigente para autores sin clonación propia (actualizada 2026-08).
|
VOICE = "NicoFeadulta2026"
|
||||||
VOICE = "nico_feadulta_es_20260802"
|
|
||||||
MODEL = "speech-2.8-hd"
|
MODEL = "speech-2.8-hd"
|
||||||
CONTAINER = "wordpress-web"
|
CONTAINER = "wordpress-web"
|
||||||
PROD = Path(__file__).resolve().parent.parent / "wordpress/wp-content/uploads/tts"
|
PROD = Path(__file__).resolve().parent.parent / "wordpress/wp-content/uploads/tts"
|
||||||
|
|||||||
Reference in New Issue
Block a user