'.esc_html(get_the_title()).'
'; echo 'Publié le '.esc_html(get_the_date()).'
'; echo 'get( 'Version' ) ); } endif; add_action( 'wp_enqueue_scripts', 'twentytwentyfive_enqueue_styles' ); // Registers custom block styles. if ( ! function_exists( 'twentytwentyfive_block_styles' ) ) : /** * Registers custom block styles. * * @since Twenty Twenty-Five 1.0 * * @return void */ function twentytwentyfive_block_styles() { register_block_style( 'core/list', array( 'name' => 'checkmark-list', 'label' => __( 'Checkmark', 'twentytwentyfive' ), 'inline_style' => ' ul.is-style-checkmark-list { list-style-type: "\2713"; } ul.is-style-checkmark-list li { padding-inline-start: 1ch; }', ) ); } endif; add_action( 'init', 'twentytwentyfive_block_styles' ); // Registers pattern categories. if ( ! function_exists( 'twentytwentyfive_pattern_categories' ) ) : /** * Registers pattern categories. * * @since Twenty Twenty-Five 1.0 * * @return void */ function twentytwentyfive_pattern_categories() { register_block_pattern_category( 'twentytwentyfive_page', array( 'label' => __( 'Pages', 'twentytwentyfive' ), 'description' => __( 'A collection of full page layouts.', 'twentytwentyfive' ), ) ); register_block_pattern_category( 'twentytwentyfive_post-format', array( 'label' => __( 'Post formats', 'twentytwentyfive' ), 'description' => __( 'A collection of post format patterns.', 'twentytwentyfive' ), ) ); } endif; add_action( 'init', 'twentytwentyfive_pattern_categories' ); // Registers block binding sources. if ( ! function_exists( 'twentytwentyfive_register_block_bindings' ) ) : /** * Registers the post format block binding source. * * @since Twenty Twenty-Five 1.0 * * @return void */ function twentytwentyfive_register_block_bindings() { register_block_bindings_source( 'twentytwentyfive/format', array( 'label' => _x( 'Post format name', 'Label for the block binding placeholder in the editor', 'twentytwentyfive' ), 'get_value_callback' => 'twentytwentyfive_format_binding', ) ); } endif; add_action( 'init', 'twentytwentyfive_register_block_bindings' ); // Registers block binding callback function for the post format name. if ( ! function_exists( 'twentytwentyfive_format_binding' ) ) : /** * Callback function for the post format name block binding source. * * @since Twenty Twenty-Five 1.0 * * @return string|void Post format name, or nothing if the format is 'standard'. */ function twentytwentyfive_format_binding() { $post_format_slug = get_post_format(); if ( $post_format_slug && 'standard' !== $post_format_slug ) { return get_post_format_string( $post_format_slug ); } } endif; // ===== TAXONOMIE "Sources" ===== function journal_register_taxonomy_sources() { $labels = array( 'name' => 'Sources', 'singular_name' => 'Source', 'search_items' => 'Rechercher des sources', 'all_items' => 'Toutes les sources', 'parent_item' => 'Source parente', 'parent_item_colon' => 'Source parente :', 'edit_item' => 'Modifier la source', 'update_item' => 'Mettre à jour la source', 'add_new_item' => 'Ajouter une nouvelle source', 'new_item_name' => 'Nom de la nouvelle source', 'menu_name' => 'Sources', ); $args = array( 'labels' => $labels, 'public' => true, 'hierarchical' => true, // parent/enfant 'show_ui' => true, 'show_admin_column' => true, 'show_in_rest' => true, 'rewrite' => array('slug' => 'sources'), ); register_taxonomy('sources', array('post'), $args); } add_action('init', 'journal_register_taxonomy_sources'); // ===== FONCTION POUR AFFICHER UN ARBRE DE TAXONOMIE ===== function journal_afficher_arbre_taxonomie($taxonomy, $title) { $terms = get_terms(array( 'taxonomy' => $taxonomy, 'hide_empty' => false, )); if (empty($terms) || is_wp_error($terms)) { return "
Aucun terme trouvé pour : " . esc_html($taxonomy) . "
"; } // Hiérarchie parent -> enfants $hierarchie = array(); foreach ($terms as $term) { $hierarchie[$term->parent][] = $term; } $selected = array(); if (isset($_GET['tax_query'][$taxonomy]) && is_array($_GET['tax_query'][$taxonomy])) { $selected = array_map('intval', $_GET['tax_query'][$taxonomy]); } $build_tree = function($parent_id) use (&$build_tree, $hierarchie, $selected, $taxonomy) { if (!isset($hierarchie[$parent_id])) return ''; $html = 'Publié le '.esc_html(get_the_date()).'
'; echo 'Aucun article trouvé.
'; } echo 'Aucun article trouvé.
'; } ob_start(); while ( $query->have_posts() ) { $query->the_post(); $post_id = get_the_ID(); $permalink = get_permalink(); echo 'Catégories : ' . wp_kses_post( $cats_list ) . '
'; } // Sources (taxonomie personnalisée) $sources = get_the_terms( $post_id, 'sources' ); if ( $sources && ! is_wp_error( $sources ) ) { $sources_names = wp_list_pluck( $sources, 'name' ); echo 'Sources : ' . esc_html( implode( ', ', $sources_names ) ) . '
'; } // Étiquettes $tags_list = get_the_tag_list( '', ', ' ); if ( $tags_list ) { echo ''; } // 🔹 EXTRAI T (et non plus le contenu complet) echo ''; echo 'Lire l’article complet'; echo '
'; echo 'Aucun article trouvé.
'; } ob_start(); echo 'Catégories : ' . wp_kses_post( $cats_list ) . '
'; } // Sources (taxonomie personnalisée) $sources = get_the_terms( $post_id, 'sources' ); if ( $sources && ! is_wp_error( $sources ) ) { $sources_names = wp_list_pluck( $sources, 'name' ); echo 'Sources : ' . esc_html( implode( ', ', $sources_names ) ) . '
'; } // Étiquettes $tags_list = get_the_tag_list( '', ', ' ); if ( $tags_list ) { echo ''; } // Extrait echo ''; echo 'Lire l’article complet'; echo '
'; // 🔹 Zone de commentaires sur la page d'accueil (ou la page du shortcode) echo '
Laisser un commentaire sur cet article
'; $comment_args = [ 'title_reply' => '', 'label_submit' => 'Envoyer le commentaire', 'comment_field' => '
', ]; // Les commentaires seront liés à la page courante (la page où se trouve le shortcode) comment_form( $comment_args ); echo '