Advertisement
fauzanjeg

Fix Featured Video for Iframe or Embed code

Jul 21st, 2021
184
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.45 KB | None | 0 0
  1. /* Fix Featured Video for Iframe or Embed code */
  2. function jnews_check_video_type( $url ) {
  3.     if ( strpos( $url, 'iframe' ) > 0 ) {
  4.         return 'iframe';
  5.     } elseif ( strpos( $url, 'youtube' ) > 0 || strpos( $url, 'youtu.be' ) > 0 ) {
  6.         return 'youtube';
  7.     } elseif ( strpos( $url, 'vimeo' ) > 0 ) {
  8.         return 'vimeo';
  9.     } elseif ( strpos( $url, 'dailymotion' ) > 0 || strpos( $url, 'dai.ly' ) > 0 ) {
  10.         return 'dailymotion';
  11.     } else {
  12.         return 'unknown';
  13.     }
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement