Created
May 10, 2020 11:59
-
-
Save jcasabona/fb1faa26bbfe01f98e2f77fd2faca708 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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