pods_audio

Output an audio field as a video player.

Description

(string) pods_audio( (string|array) $url, (bool) $args = false ); 

Returns (string)

Parameters (2)

0. $url (string|array)
Can be a URL of the source file, or a Pods audio field.
1. $args — Optional. (bool) => false
Additional arguments to pass to wp_audio_shortcode

Usage

  1. if ( !function_exists( 'pods_audio' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'pods-custom-content-types-and-fields/includes/media.php'; 
  3.  
  4. // Can be a URL of the source file, or a Pods audio field. 
  5. $url = null; 
  6.  
  7. // Optional. Additional arguments to pass to wp_audio_shortcode 
  8. $args = false; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = pods_audio($url, $args); 
  12.  

Defined (1)

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

/includes/media.php  
  1. function pods_audio( $url, $args = false ) { 
  2.  
  3. if ( is_array( $url ) ) { 
  4. if ( ! is_null( pods_v( 'ID', $url ) ) ) { 
  5. $id = pods_v( 'ID', $url ); 
  6. $url = wp_get_attachment_url( $id ); 
  7. else { 
  8. return; 
  9.  
  10.  
  11. $audio_args = array( 'src' => $url ); 
  12.  
  13. if ( is_array( $args ) ) { 
  14. $audio_args = array_merge( $audio_args, $args ); 
  15.  
  16. return wp_audio_shortcode( $args ); 
  17.