Powerpress PHP API
-
I’ve noticed some very specific powerpress PHP functions (e.g.
powerpress_get_enclosure_data) but I am unable to find a comprehensive list of these functions and their inputs/outputs.
Is there such a resource that I can look through? I love the plugin but the documentation (that I’ve found) doesn’t include raw developer resources.Cheers!
-
Hello @cclark07,
Some of the useful functions such as powerpress_get_enclosure_data() are briefly discussed here: https://create.blubrry.com/resources/powerpress/powerpress-and-your-theme/ For the most part, most functions within PowerPress are for internal use within he plugin and are not documented for other plugins or themes to use, but obviously some such as the powerpress_get_enclosure_data() function have a lot of use outside of PowerPress and are mentioned on that page linked.
Just to get you further along, the powerpress_get_enclosure_data returns a PHP array, the array is a set of key=>value pairs. The most important value is the media url, the key for the URL is ‘url’. e.g.
if( function_exists('powerpress_get_enclosure_data') ) { $episodeData = powerpress_get_enclosure_data( get_the_ID() ); if( !empty($episodeData['url']) ) { echo 'Media URL: '.$episodeData['url']."\n"; } }The $episodeData array has many key values. What data do you need I can reference the code to tell you which keys you may need.
Thanks,
AngeloThanks for the quick response @amandato!
I’m using the plugin mainly to gather the RSS feed information and create custom posts. My plan was to then manually access the data via PHP in the post template and create my own markup/styles. At the moment I’ve found ways to access the data I need but it’s still in early development so that may change (requirements shift often unfortunately).
I should have a better idea of what is missing, if anything, early next week. I’ll post here to confirm all is well, or to ask for some more help if necessary.One thing that I’m curious about is if it’s possible to pull in new RSS items as they are published to Libsyn. Otherwise our editors will need to manually update the posts by re-importing the feed. It’s not the end of the world if that is the case, but it would be nice to automate as much as possible.
Thanks again!
-
This reply was modified 8 years, 7 months ago by
cclark07.
PowerPress doesn’t have the ability to continuously import new information from an external feed. You’d have to either manually copy new entries to the site or possibly run the import tool again. But, running the import tool multiple times could cause issues over time and isn’t really recommended. PowerPress import is really meant to be a one-and-done procedure.
Hello @cclark07,
That sounds awesome! If you end up making this into a plugin that is listed on WordPress.org, please met me know, we will link to it.
As for Pulling RSS feeds (libsyn or not), you can use the RSS import tool in PowerPress. It is not designed to be used programmatically though, as there are possible complication during the feed import process, but it would import a feed. Most users who host at LibSyn who use WordPress with PowerPress simply use LibSyn as a paste to upload the files then they write everything from within PowerPress. Usually once folks get to that point they discover they can switch to Blubrry Podcast Hosting to have the ease of uploading and publishing all right from their WordPress site.
There are big benefits NOT to import the feed but to manually enter the show notes and such within WordPress with PowerPress. With iOS11 for example, the RSS links are now shown in the Podcasts app, which if you import from LibSyn, the link will not be to your blog but to the media file which defeats the purpose of the link itself. Hope this helps.
Hey @shawnogordo, @amandato,
I’m not sure I’ll be bundling this up into a plugin just yet, but maybe in the future! I’m currently trying to create a re-usable Podcast Episode component so we can highlight specific episodes throughout our site.
I’ve successfully pulled all of the meta data from the post object (enclosure, metamarks, etc.), the issue I’m having now is rendering the podcast player within the component template file. So, in the post template file (single-podcast.php)the_powerpress_content();works fine. However, I’m trying to reference this outside of that file and it is returning an empty string.
Is there a way to pull the content (audio player, player links) for a specific post object/id?Our set up might be a little confusing so let me know if you need clarification!
Cheers!
Update: I’ve found a way to embed the player in a non-post template file. It requires calling the
do_shortcode()PHP function and passing in the powerpress shortcode syntax.
Just for anyone who needs it, my call looks like this:
<?php echo do_shortcode('[powerpress url="'.$podcast_episode_audio.'"]'); ?>The
$podcast_episode_audiovariable is the url pulled from the enclosure data returned from thepowerpress_get_enclosure_data()function:
$podcast_enclosure_data = powerpress_get_enclosure_data($post_id, $feed_slug='your_feed_slug');
$podcast_episode_audio = $podcast_enclosure_data['url'];I’m now working on pulling the download link in a similar manner. I will update here if/when I find the solution.
Hello @cclark07,,
Glad you figured it out! The do_shortcode() call is optimal for your situation in the event you are outside of the normal WordPress “loop” where it displays blog posts / page content. Keep in mind though that if you do the url=”” in the shortcode, the player will only appear, the subscribe and player links are not available in this case.
Thanks,
Angelo -
This reply was modified 8 years, 7 months ago by
The topic ‘Powerpress PHP API’ is closed to new replies.