handling short titles for conseils and questions-container
This commit is contained in:
parent
827309f064
commit
3cf95bae16
|
|
@ -223,12 +223,15 @@ function build_page_chapter_index($blocks)
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
if ($block['blockName'] == 'homegrade-content-blocks/questions-container') {
|
if ($block['blockName'] == 'homegrade-content-blocks/questions-container') {
|
||||||
|
if (!$block || !$block['attrs'] || $block['attrs']['relatedPostId'] == 0) continue;
|
||||||
|
$shortTitle = get_field('short_title', $block['attrs']['relatedPostId']);
|
||||||
|
|
||||||
$anchor = isset($block['attrs']['anchor']) ? esc_html($block['attrs']['anchor']) : "questions-container-" . $block['attrs']['relatedPostId'];
|
$anchor = isset($block['attrs']['anchor']) ? esc_html($block['attrs']['anchor']) : "questions-container-" . $block['attrs']['relatedPostId'];
|
||||||
|
|
||||||
array_push($chapterBlockIndex, [
|
array_push($chapterBlockIndex, [
|
||||||
'block-type' => $block['blockName'],
|
'block-type' => $block['blockName'],
|
||||||
'anchor' => '#' . $anchor,
|
'anchor' => '#' . $anchor,
|
||||||
'title' => get_the_title($block['attrs']['relatedPostId']),
|
'title' => $shortTitle ? $shortTitle : get_the_title($block['attrs']['relatedPostId']),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
if ($block['blockName'] == 'homegrade-content-blocks/vocabulaire-summary') {
|
if ($block['blockName'] == 'homegrade-content-blocks/vocabulaire-summary') {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user