podPress is a very complex plugin and it is not easy to find the right line of code if you are not familiar with it and getting familiar with it takes takes time.
is there a method/function that i can use to call the URL of the media file added to the post?
No, podPress has no API function. But there are several filter hooks you could use to modify URLs and other elements of the podPress output.
All hooks are listed on the Other Notes page in the section Filter Hooks of podPress.
For instance:
You could use the hook podpress_downloadlinks
and write you a little filter plugin. This filter hook is to filter the podPress row below the player (all what is between <!-- Begin: podPress download link line -->
and <!-- End: podPress download link line -->
these comments included).
A filter which may replace certain download buttons could look like this:
add_filter('podpress_downloadlinks', 'filter_podpress_download_button_img_urls');
function filter_podpress_download_button_img_urls($podpressdownloadlinks) {
// retrieve the URL of the download button out of the code of this line
$result = preg_match('/\<img src=\"(.+)\" class=\"podPress_imgicon\" alt=\"\" \/\>/i', $podpressdownloadlinks, $matches);
if ( 1 === $result ) { // img URL found
// if there is a download image then compare the URL (matches[1]) to discover which image it is and replace the URL with a different one
// (matches[0] contains the complete <img> tag)
Switch ($matches[1]) {
case PODPRESS_URL . '/images/audio_mp3_button.png' :
$new_url = PODPRESS_URL . '/images/audio_mp3_icon.png'; // in this example the button URL of the download button of mp3 files gets exchanged with the icon URL
break;
default :
$new_url ='';
break;
}
// if the URL should be replaced then replace it. otherwise return code unchanged
if ( '' !== $new_url ) {
return str_replace($matches[1], $new_url, $podpressdownloadlinks);
} else {
return $podpressdownloadlinks;
}
} else {
return $podpressdownloadlinks;
}
}
You can put this code in the functions.php of your theme or in a php file e.g. podpress_filters.php along with:
/*
Plugin Name: podPress filters
Plugin URI:
Description: some filters for the output of podPress
Author: ntm
Version: 1.0
Author URI:
*/
(This should be placed at the beginning of the php file before the other code.)
podpress_filters.php should be placed in the plugin folder or in a separate sub folder like /wp-content/plugins/podpress_filters/podpress_filters.php. If you do that, it will among the other plugins on the plugins page of your blog and you can easily switch it on and off.
If you really like to know how podPress assembles the output then take a look in the podpress_class.php file (line 1000-1325) which retrieves the data from the wp_postmeta table and in the podpress_theme.php file which assembles the output.
But I recommend to use the filter hooks and a filter plugin.
Regards,
Tim