Skip to content

Instantly share code, notes, and snippets.

@jcasabona
Created May 10, 2020 11:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jcasabona/fb1faa26bbfe01f98e2f77fd2faca708 to your computer and use it in GitHub Desktop.
Save jcasabona/fb1faa26bbfe01f98e2f77fd2faca708 to your computer and use it in GitHub Desktop.
<?php
function wpp_get_media_URL() {
if ( function_exists( 'powerpress_get_enclosure_data' ) ) {
$episodeData = powerpress_get_enclosure_data( get_the_ID() );
if ( ! empty( $episodeData['url'] ) ) {
return $episodeData['url'];
}
}
return false;
}
function wpp_fusebox_insert( $content ) {
// No player in the Feed!
if (is_feed() ) {
return $content;
}
$url = wpp_get_media_URL();
if ( $url ) {
$format = '[fusebox_track_player url="%s" title="%s"]';
return do_shortcode( sprintf( $format, $url, get_the_title() ) ). $content;
}
return $content;
}
add_filter( 'the_content', 'wpp_fusebox_insert', 100 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment