Advertisement
phpface

Untitled

Jun 13th, 2022 (edited)
975
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.45 KB | None | 0 0
  1. // Video Post Type ID, Retrieve the post ID within the query loop
  2. $post_id = get_the_ID();
  3.  
  4. $source = streamtube_core()->get()->post->get_source( $post_id );
  5.  
  6. // OR $source = get_post_meta( $post_id, 'video_url', true );
  7.  
  8. if( wp_attachment_is( 'video', $source ) ){
  9.     // Source is a video attachment
  10.     // Get playable url
  11.     $source_url = wp_get_attachment_url( $source );
  12. }else{
  13.     // Otherwise, source is an URL or embed/script code.
  14. }
  15.  
  16.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement