diff --git a/includes/utilities.php b/includes/utilities.php index 22187b4..f3e5a30 100644 --- a/includes/utilities.php +++ b/includes/utilities.php @@ -203,11 +203,13 @@ function build_page_chapter_index($blocks) } } 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, [ 'block-type' => $block['blockName'], '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') {