Skip to content

Commit

Permalink
check if updates is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffreyvr committed Apr 28, 2023
1 parent df6f828 commit c4d2f06
Showing 1 changed file with 21 additions and 19 deletions.
40 changes: 21 additions & 19 deletions includes/elb-functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -527,25 +527,27 @@ function elb_add_meta_data() {
'publisher' => $organization
);

foreach ( $items['updates'] as $entry ) {
$entry_url = add_query_arg( 'entry', $entry['id'], $liveblog_url );

$_entry = array(
'@type' => 'BlogPosting',
'headline' => $entry['title'],
'url' => $entry_url,
'mainEntityOfPage' => $entry_url,
'datePublished' => $entry['datetime'],
'dateModified' => $entry['modified'],
'articleBody' => trim( preg_replace( '/\s+/', ' ', strip_tags( $entry['content'] ) ) ),
);

if ( elb_display_author_name() ) {
$_entry['author'] = $organization;
}

$entries[] = $_entry;
}
if ( ! empty( $items['updates'] ) ) {
foreach ( $items['updates'] as $entry ) {
$entry_url = add_query_arg( 'entry', $entry['id'], $liveblog_url );

$_entry = array(
'@type' => 'BlogPosting',
'headline' => $entry['title'],
'url' => $entry_url,
'mainEntityOfPage' => $entry_url,
'datePublished' => $entry['datetime'],
'dateModified' => $entry['modified'],
'articleBody' => trim( preg_replace( '/\s+/', ' ', strip_tags( $entry['content'] ) ) ),
);

if ( elb_display_author_name() ) {
$_entry['author'] = $organization;
}

$entries[] = $_entry;
}
}

wp_reset_postdata();

Expand Down

0 comments on commit c4d2f06

Please sign in to comment.