handling short title
This commit is contained in:
parent
32f831a629
commit
d8b54de491
|
|
@ -203,11 +203,13 @@ function build_page_chapter_index($blocks)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($block['blockName'] == 'homegrade-content-blocks/post-content-container') {
|
if ($block['blockName'] == 'homegrade-content-blocks/post-content-container') {
|
||||||
$anchor = isset($block['attrs']['anchor']) ? esc_html($block['attrs']['anchor']) : "post-content-container-" . $block['attrs']['relatedPostId'];
|
$shortTitle = get_field('short_title', $block['attrs']['relatedPostId']);
|
||||||
|
|
||||||
|
$anchor = !empty($block['attrs']['anchor']) ? esc_html($block['attrs']['anchor']) : "post-content-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/questions-container') {
|
if ($block['blockName'] == 'homegrade-content-blocks/questions-container') {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user