diff --git a/single-conseils.php b/single-conseils.php index 7565950..83d5735 100644 --- a/single-conseils.php +++ b/single-conseils.php @@ -5,6 +5,19 @@ if (!function_exists('build_share_urls')) { { $chapterBlockIndex = []; foreach ($blocks as $key => $block) { + if ($block['blockName'] == 'homegrade-content-blocks/chapitrage-thematique') { + foreach ($block['innerBlocks'] as $key => $innerBlock) { + if (!$innerBlock['attrs']['chapterTitle']) continue; + + $cleanedTitle = strtolower(preg_replace("/[^a-zA-Z]/", "", $innerBlock['attrs']['chapterTitle'])); + + array_push($chapterBlockIndex, [ + 'block-type' => $block['blockName'], + 'anchor' => '#' . $cleanedTitle, + 'title' => $innerBlock['attrs']['chapterTitle'], + ]); + } + } if ($block['blockName'] == 'homegrade-content-blocks/questions-container') { array_push($chapterBlockIndex, [ 'block-type' => $block['blockName'],