/*
Theme Name: OceanWP Child Theme
Theme URI: https://oceanwp.org/
Description: OceanWP WordPress theme. Sample child theme.
Author: OceanWP
Author URI: https://oceanwp.org/
Template: oceanwp
Version: 1.0
*/


/*
add_filter('the_content', function($content) {
    if (is_single() && in_the_loop() && is_main_query()) {
        global $post;
        
        // 1. On va chercher TOUTES les taxonomies (catégories) rattachées à cet article
        $taxonomies = get_object_taxonomies($post->post_type, 'objects');
        $liens_categories = array();
        
        foreach ($taxonomies as $taxonomy) {
            // On exclut les étiquettes de formats ou structures internes invisibles
            if (in_array($taxonomy->name, array('post_format', 'elementor_library_category'))) {
                continue;
            }
            
            // Récupération des termes (Noël, Carême, Triduun Pascal...)
            $terms = get_the_terms($post->ID, $taxonomy->name);
            if ($terms && !is_wp_error($terms)) {
                foreach ($terms as $term) {
                    $liens_categories[] = '<a href="' . esc_url(get_term_link($term)) . '">' . esc_html($term->name) . '</a>';
                }
            }
        }
        
        // 2. Si on a trouvé des éléments, on génère le rendu visuel centré
        if (!empty($liens_categories)) {
            // On retire les doublons éventuels et on sépare par une virgule
            $liste_unique = implode(', ', array_unique($liens_categories));
            
            $bloc_categories = '<div class="bloc-cat-liturgique" style="text-align: center !important; width: 100% !important; display: block !important; margin: 30px 0 15px 0;">';
            $bloc_categories .= '<style>.bloc-cat-liturgique, .bloc-cat-liturgique a { text-align: center !important; display: inline-block !important; font-weight: bold; color: #006699; text-decoration: none; }</style>';
            $bloc_categories .= $liste_unique;
            $bloc_categories .= '</div>';
            
            return $content . $bloc_categories;
        }
    }
    return $content;
});
*/