rtmedia_type

Get Media type using Media ID.

Description

(bool|string) rtmedia_type( (bool) $id = false ); 

Returns (bool|string)

Parameters (1)

0. $id — Optional. (bool) => false
The id.

Usage

  1. if ( !function_exists( 'rtmedia_type' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'rtmedia-for-wordpress-buddypress-and-bbpress/app/main/controllers/template/rtmedia-functions.php'; 
  3.  
  4. // The id. 
  5. $id = false; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = rtmedia_type($id); 
  9.  

Defined (1)

The function is defined in the following location(s).

/app/main/controllers/template/rtmedia-functions.php  
  1. function rtmedia_type( $id = false ) { 
  2.  
  3. if ( $id ) { 
  4. $model = new RTMediaModel(); 
  5. $media = $model->get_media( array( 
  6. 'id' => $id,  
  7. ), 0, 1 ); 
  8.  
  9. if ( isset( $media[0] ) && isset( $media[0]->media_type ) ) { 
  10. return $media[0]->media_type; 
  11. } else { 
  12. return false; 
  13. } else { 
  14. global $rtmedia_media; 
  15.  
  16. return $rtmedia_media->media_type; 
  17.