0 ) {
$post_id = (int) $post_id_attr;
} else {
$post_id = get_the_ID();
}
$is_demo = false === $post_id;
$mode = $attributes['mode'] ?? 'image';
if ( ! $post_id && ! $is_demo ) {
return '';
}
if ( 'video' === $mode ) :
$video_guid = $is_demo ? 'NGYE1Hqy' : get_post_meta( $post_id, 'guid', true );
$embed_url = 'https://video.wordpress.com/v/' . esc_attr( $video_guid ) . '?resizeToParent=true&cover=false&preloadContent=metadata&useAverageColor=true&muted=true';
?>
poster ?? '';
}
$duration = $video_details->duration ?? false;
if ( false !== $duration ) {
$duration = $duration / 1000;
if ( $duration >= 3600 ) {
$date_format = 'H:i:s';
}
}
}
if ( '' !== $post_thumbnail ) {
$token = vphq_get_metadata_token_if_required( $guid );
if ( false !== $token ) {
$post_thumbnail = add_query_arg( 'metadata_token', $token, $post_thumbnail );
}
}
if ( empty( $post_thumbnail ) ) {
// if there is no thumbnail, force an error
$post_thumbnail = 'invalid-image.jpg';
}
?>