Skip to content

Commit

Permalink
Update vanilla video markup getter method
Browse files Browse the repository at this point in the history
  • Loading branch information
lushkant committed Feb 11, 2024
1 parent 4103b7b commit 15892c2
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions includes/class-frontend.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,24 @@ public function get_post_video( $html, $post_id, $post_thumbnail_id, $size, $att

if ( ! empty( $post_types ) ) {
if ( in_array( $post->post_type, $post_types, true ) ) {
// Get the meta value of video attachment.
$video_id = get_post_meta( $post_id, RSFV_META_KEY, true );

// Get the meta value of video embed url.
$embed_url = get_post_meta( $post->ID, RSFV_EMBED_META_KEY, true );
$video_source = get_post_meta( $post->ID, RSFV_SOURCE_META_KEY, true );
$video_source = $video_source ? $video_source : 'self';

if ( 'self' === $video_source ) {
// Get the meta value of video attachment.
$video_id = get_post_meta( $post->ID, RSFV_META_KEY, true );

if ( $video_id || $embed_url ) {
return '<div style="clear:both">' . do_shortcode( '[rsfv]' ) . '</div>';
if ( $video_id ) {
return '<div style="clear:both">' . do_shortcode( '[rsfv]' ) . '</div>';
}
} else {
// Get the meta value of video embed url.
$embed_url = get_post_meta( $post_id, RSFV_EMBED_META_KEY, true );

if ( $embed_url ) {
return '<div style="clear:both">' . do_shortcode( '[rsfv]' ) . '</div>';
}
}
}
}
Expand Down

0 comments on commit 15892c2

Please sign in to comment.