diff --git a/wordpress/wp-content/mu-plugins/fea-audio-player.php b/wordpress/wp-content/mu-plugins/fea-audio-player.php new file mode 100644 index 0000000..ecb7c9f --- /dev/null +++ b/wordpress/wp-content/mu-plugins/fea-audio-player.php @@ -0,0 +1,62 @@ +' + . '' + . ' Escucha' + . '' + . ''; +} + +// Inyecta el player como último hijo de la fila flex del autor (el grupo que +// contiene el core/avatar en la cabecera FSE del single). +add_filter('render_block', function ($html, $block) { + if (!is_singular('post')) return $html; + if (($block['blockName'] ?? '') !== 'core/group') return $html; + $has_avatar = false; + foreach ($block['innerBlocks'] ?? [] as $ib) { + if (($ib['blockName'] ?? '') === 'core/avatar') { $has_avatar = true; break; } + } + if (!$has_avatar) return $html; + $player = fea_audio_player_html(); + if (!$player) return $html; + $pos = strrpos($html, ''); + return $pos === false ? $html . $player : substr($html, 0, $pos) . $player . substr($html, $pos); +}, 10, 2); + +add_action('wp_head', function () { + if (!is_singular('post')) return; + if (!get_post_meta(get_queried_object_id(), 'fea_audio_url', true)) return; + ?> + +