handling errors and empty values
This commit is contained in:
parent
dc2c7ef981
commit
b00361a94f
|
|
@ -203,9 +203,10 @@ function build_page_chapter_index($blocks)
|
|||
}
|
||||
}
|
||||
if ($block['blockName'] == 'homegrade-content-blocks/post-content-container') {
|
||||
if ($block || $block['attrs'] || $block['attrs']['relatedPostId'] == 0) continue;
|
||||
$shortTitle = get_field('short_title', $block['attrs']['relatedPostId']);
|
||||
|
||||
$anchor = !empty($block['attrs']['anchor']) ? esc_html($block['attrs']['anchor']) : "post-content-container-" . $block['attrs']['relatedPostId'];
|
||||
$anchor = $block['attrs'] && !empty($block['attrs']['anchor']) ? esc_html($block['attrs']['anchor']) : "post-content-container-" . $block['attrs']['relatedPostId'];
|
||||
array_push($chapterBlockIndex, [
|
||||
'block-type' => $block['blockName'],
|
||||
'anchor' => "#" . $anchor,
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user