Below, you’ll find a detailed guide on how to add the PowerPress Podcasting by Blubrry Shortcodes to your WordPress website, including their parameters, examples, and PHP function code. Additionally, we’ll assist you with common issues that might cause the PowerPress Podcasting by Blubrry Plugin shortcodes not to show or not to work correctly.
Before starting, here is an overview of the PowerPress Podcasting by Blubrry Plugin and the shortcodes it provides:
"PowerPress Podcasting plugin by Blubrry is a dynamic tool that enhances your WordPress site with podcasting capabilities. Ideal for broadcasting your creative content."
- [display_podcast]
- [podcastlist]
- []
- [ppn_shortcode]
PowerPress Podcasting [display_podcast] Shortcode
The PowerPress shortcode allows users to display a podcast player on their website. It accepts various attributes like URL, feed, channel, image, width, and height. The function powerpress_shortcode_handler handles the shortcode. It checks if the page is a feed, extracts the attributes, and based on these attributes, it either generates a podcast player or a placeholder.
Shortcode: [display_podcast]
Parameters
Here is a list of all possible display_podcast shortcode parameters and attributes:
url
– URL of the podcast media file.feed
– Identifier of the feed for backward compatibility.channel
– Channel identifier of the podcast.slug
– Latest way to specify the podcast feed slug.image
– URL of the image to be displayed with the podcast.width
– Width of the podcast player.height
– Height of the podcast player.sample
– A placeholder that is replaced with the actual audio or video player upon publishing.
Examples and Usage
Basic example – Displays the podcast associated with the provided slug.
[display_podcast slug="my-podcast"]
Advanced examples
Displays the podcast associated with the provided slug and overrides the default image, width, and height.
[display_podcast slug="my-podcast" image="https://example.com/my-image.jpg" width="500" height="300"]
Displays a placeholder for the podcast player in the post edit screen. Upon publishing, it will be replaced with the actual podcast player.
[display_podcast slug="my-podcast" sample="true"]
Displays the podcast associated with the provided slug and URL. If the URL is not found, it will display a placeholder.
[display_podcast slug="my-podcast" url="https://example.com/my-podcast.mp3"]
Displays the podcast associated with the provided channel. If the channel is not found, it will display a placeholder.
[display_podcast channel="my-channel"]
PHP Function Code
In case you have difficulties debugging what causing issues with [display_podcast]
shortcode, check below the related PHP functions code.
Shortcode line:
add_shortcode('display_podcast', 'powerpress_shortcode_handler');
Shortcode PHP function:
function powerpress_shortcode_handler( $attributes, $content = null )
{
global $post, $g_powerpress_player_added;
// We can't add flash players to feeds
if( is_feed() )
return '';
$return = '';
$feed = '';
$channel = '';
$slug = ''; // latest and preferred way to specify the feed slug
$url = '';
$image = '';
$width = '';
$height = '';
$sample = '';
if (is_array($attributes)) {
$attributes = array_filter($attributes, function ($var) {
if (strpos($var, 'javascript:') === 0) {
return '';
} else {
return $var;
}
});
}
extract( shortcode_atts( array(
'url' => '',
'feed' => '',
'channel' => '',
'slug' => '',
'image' => '',
'width' => '',
'height' => '',
'sample' => ''
), $attributes ) );
if( empty($channel) && !empty($feed) ) // Feed for backward compat.
$channel = $feed;
if( !empty($slug) ) // Foward compatibility
$channel = $slug;
if( !$url && $content )
{
$content_url = trim($content);
if( @parse_url($content_url) )
$url = $content_url;
}
if( $url && !$sample )
{
$url = powerpress_add_redirect_url($url);
$content_type = '';
// Handle the URL differently...
do_action('wp_powerpress_player_scripts');
$return = apply_filters('powerpress_player', '', powerpress_add_flag_to_redirect_url($url, 'p'), array('image'=>$image, 'type'=>$content_type,'width'=>$width, 'height'=>$height) );
}
else if( $channel )
{
if (!empty($post)) {
$post_id = $post->ID;
} else {
$post_id = -1;
}
$EpisodeData = powerpress_get_enclosure_data($post_id, $channel);
if( !empty($EpisodeData['embed']) )
$return = $EpisodeData['embed'];
// Shortcode over-ride settings:
if( !empty($image) )
$EpisodeData['image'] = $image;
if( !empty($width) )
$EpisodeData['width'] = $width;
if( !empty($height) )
$EpisodeData['height'] = $height;
if (!empty($url)) {
$EpisodeData['url'] = $url;
}
if ($sample && empty($EpisodeData['url'])) {
// sample player for edit screen block pre-publish
$return .= "<p>This is a placeholder. Upon publishing, it will be replaced with the actual audio or video player.</p>";
$EpisodeData['url'] = "https://media.blubrry.com/blubrrypreview/content.blubrry.com/blubrrypreview/transcript_test_episode.mp3";
}
if (empty($EpisodeData['feed']) && !empty($channel)) {
$EpisodeData['feed'] = $channel;
}
if (empty($EpisodeData['type'])) {
$EpisodeData['type'] = '';
}
$GeneralSettings = get_option('powerpress_general');
if( isset($GeneralSettings['premium_caps']) && $GeneralSettings['premium_caps'] && !powerpress_premium_content_authorized($channel) )
{
$return .= powerpress_premium_content_message($post_id, $channel, $EpisodeData);
}
else
{
// If the shortcode specifies a channel, than we definitely want to include the player even if $EpisodeData['no_player'] is true...
if( !isset($EpisodeData['no_player']) && !empty($EpisodeData['url']) ) {
do_action('wp_powerpress_player_scripts');
$return .= apply_filters('powerpress_player', '', powerpress_add_flag_to_redirect_url($EpisodeData['url'], 'p'), array('id'=>$post_id,'feed'=>$channel, 'channel'=>$channel, 'image'=>$image, 'type'=>$EpisodeData['type'],'width'=>$width, 'height'=>$height) );
}
if( empty($EpisodeData['no_links']) && !empty($EpisodeData['url']) ) {
do_action('wp_powerpress_player_scripts');
$return .= apply_filters('powerpress_player_links', '', powerpress_add_flag_to_redirect_url($EpisodeData['url'], 'p'), $EpisodeData );
$return .= apply_filters('powerpress_player_subscribe_links', '', powerpress_add_flag_to_redirect_url($EpisodeData['url'], 'p'), $EpisodeData );
}
}
}
else
{
$GeneralSettings = get_option('powerpress_general');
if( !isset($GeneralSettings['custom_feeds']['podcast']) )
$GeneralSettings['custom_feeds']['podcast'] = 'Podcast Feed'; // Fixes scenario where the user never configured the custom default podcast feed.
// If we have post type podcasting enabled, then we need to use the podcast post type feeds instead here...
if( !empty($GeneralSettings['posttype_podcasting']) )
{
$post_type = get_query_var('post_type');
if ( is_array( $post_type ) ) {
$post_type = reset( $post_type ); // get first element in array
}
// Get the feed slugs and titles for this post type
$PostTypeSettingsArray = get_option('powerpress_posttype_'.$post_type);
// Loop through this array...
if( !empty($PostTypeSettingsArray) )
{
switch($post_type)
{
case 'post':
case 'page': {
// Do nothing!, we want the default podcast and channels to appear in these post types
}; break;
default: {
$GeneralSettings['custom_feeds'] = array(); // reset this array since we're working with a custom post type
};
}
if (is_array($PostTypeSettingsArray)) {
foreach ($PostTypeSettingsArray as $feed_slug => $postTypeSettings) {
if (!empty($postTypeSettings['title']))
$GeneralSettings['custom_feeds'][$feed_slug] = $postTypeSettings['title'];
else
$GeneralSettings['custom_feeds'][$feed_slug] = $feed_slug;
}
}
}
}
if (is_array($GeneralSettings['custom_feeds'])) {
foreach ($GeneralSettings['custom_feeds'] as $feed_slug => $feed_title) {
if (isset($GeneralSettings['disable_player']) && isset($GeneralSettings['disable_player'][$feed_slug]))
continue;
$EpisodeData = powerpress_get_enclosure_data($post->ID, $feed_slug);
if (!$EpisodeData && !empty($GeneralSettings['process_podpress']) && $feed_slug == 'podcast')
$EpisodeData = powerpress_get_enclosure_data_podpress($post->ID);
if (!$EpisodeData)
continue;
if (!empty($EpisodeData['embed']))
$return .= $EpisodeData['embed'];
// Shortcode over-ride settings:
if (!empty($image))
$EpisodeData['image'] = $image;
if (!empty($width))
$EpisodeData['width'] = $width;
if (!empty($height))
$EpisodeData['height'] = $height;
if (isset($GeneralSettings['premium_caps']) && $GeneralSettings['premium_caps'] && !powerpress_premium_content_authorized($feed_slug)) {
$return .= powerpress_premium_content_message($post->ID, $feed_slug, $EpisodeData);
continue;
}
if (!isset($EpisodeData['no_player'])) {
do_action('wp_powerpress_player_scripts');
$return .= apply_filters('powerpress_player', '', powerpress_add_flag_to_redirect_url($EpisodeData['url'], 'p'), $EpisodeData);
}
if (!isset($EpisodeData['no_links'])) {
do_action('wp_powerpress_player_scripts');
$return .= apply_filters('powerpress_player_links', '', powerpress_add_flag_to_redirect_url($EpisodeData['url'], 'p'), $EpisodeData);
$return .= apply_filters('powerpress_player_subscribe_links', '', powerpress_add_flag_to_redirect_url($EpisodeData['url'], 'p'), $EpisodeData);
}
}
}
}
return $return;
}
Code file location:
powerpress/powerpress/powerpress-player.php
PowerPress Podcasting [podcastlist] Shortcode
The PowerPress Playlist shortcode allows you to display a list of podcast episodes on your WordPress site. By adding this shortcode, users can easily access and play your podcast content.
Shortcode: [podcastlist]
Examples and Usage
Basic example – The powerpress plugin shortcode ‘podcastlist’ is used to display a list of podcast episodes on your webpage. Here’s a basic usage of this shortcode:
[podcastlist /]
With this shortcode, all podcast episodes will be listed in the default order. No extra parameters are added in this basic usage.
PHP Function Code
In case you have difficulties debugging what causing issues with [podcastlist]
shortcode, check below the related PHP functions code.
Shortcode line:
add_shortcode( 'podcastlist', 'powerpress_playlist_shortcode' );
Shortcode PHP function:
f
Code file location:
powerpress/powerpress/powerpress-playlist.php
PowerPress Podcasting [null] Shortcode
The PowerPress Subscribe shortcode is a feature of the PowerPress plugin that allows users to add a podcast subscription button to their WordPress site. By using the shortcode [powerpresssubscribe], users can customize their podcast subscription options, including the channel, feed, post type, and category. It also allows for customization of the display, such as the title, subtitle, feed URL, and iTunes URL. This shortcode is especially useful for podcasters looking to increase their listener base.
Shortcode: [null]
Parameters
Here is a list of all possible null shortcode parameters and attributes:
channel
– specifies the PowerPress Podcast Channel to be usedslug
– alternate for ‘channel’, used for PowerPressfeed
– another alternate for ‘channel’, used for PowerPresspost_type
– defines the type of post for PowerPresscategory
– assigns a specific category ID, name, or slug for PowerPressterm_taxonomy_id
– sets a specific term taxonomy ID for PowerPresstitle
– displays a custom title of the show or programsubtitle
– adds a subtitle for the podcastfeed_url
– provides a subscribe widget for a specific RSS feeditunes_url
– provides a subscribe widget for a specific iTunes URLimage_url
– provides a subscribe widget for a specific iTunes URLheading
– assigns a heading label for the podcastitunes_subtitle
– includes the iTunes subtitle in the subscribe widgetitunes_button
– uses only the iTunes button if set to ‘true’itunes_banner
– uses only the iTunes banner if set to ‘true’style
– applies a specific style to the iTunes banner
Examples and Usage
Basic example – Displaying the default podcast subscribe button using the ‘powerpresssubscribe’ shortcode.
[powerpresssubscribe /]
Advanced examples
Displaying a specific podcast channel’s subscribe button by using the ‘slug’ attribute. Here, ‘my-podcast’ is the slug of the specific podcast channel.
[powerpresssubscribe slug="my-podcast" /]
Customizing the subscribe button by providing a custom title and subtitle for the podcast. This will override the default title and subtitle of the podcast.
[powerpresssubscribe title="My Custom Title" subtitle="My Custom Subtitle" /]
Using the shortcode to display a subscribe button for a specific RSS feed and iTunes URL. This will override the default feed and iTunes URL of the podcast.
[powerpresssubscribe feed_url="http://example.com/rss" itunes_url="http://itunes.apple.com/my-podcast" /]
Displaying the iTunes button only for the podcast using the ‘itunes_button’ attribute. This will display only the iTunes button instead of the default subscribe buttons.
[powerpresssubscribe itunes_button="true" /]
Displaying a subscribe button for a specific category of podcasts. The ‘category’ attribute is used to specify the category ID, name, or slug.
[powerpresssubscribe category="news" /]
PHP Function Code
In case you have difficulties debugging what causing issues with [null]
shortcode, check below the related PHP functions code.
Shortcode line:
add_shortcode( 'powerpresssubscribe', 'powerpress_subscribe_shortcode' );
Shortcode PHP function:
function powerpress_subscribe_shortcode( $attr ) {
if ( is_feed() ) {
return '';
}
// Only works on pages...
if ( !is_singular() ) {
if( empty($attr['archive']) )
return '';
}
/*
extract( shortcode_atts( array(
'channel'=>'', // Used for PowerPress Podcast Channels
'slug' => '', // Used for PowerPress (alt for 'channel')
'feed' => '', // Used for PowerPress (alt for 'channel')
'post_type' => 'post', // Used for PowerPress
'category'=>'', // Used for PowerPress (specify category ID, name or slug)
'term_taxonomy_id'=>'', // Used for PowerPress (specify term taxonomy ID)
//'term_id'=>'', // Used for PowerPress (specify term ID, name or slug)
//'taxonomy'=>'', // Used for PowerPress (specify taxonomy name)
'title' => '', // Display custom title of show/program
'subtitle'=>'', // Subtitle for podcast (optional)
'feed_url'=>'', // provide subscribe widget for specific RSS feed
'itunes_url'=>'', // provide subscribe widget for specific iTunes subscribe URL
'image_url'=>'', // provide subscribe widget for specific iTunes subscribe URL
'heading'=>'', // heading label for podcast
'itunes_subtitle'=>'', // Set to 'true' to include the iTunes subtitle in subscribe widget
// Appearance attributes
'itunes_button'=>'', // Set to 'true' to use only the iTunes button
'itunes_banner'=>'', // Set to 'true' to use only the iTunes banner
'style'=>'' // Set to 'true' to use only the iTunes banner
), $attr, 'powerpresssubscribe' ) );
//return print_r($attr, true);
*/
/**/
if( !is_array($attr) ) // Convert to an array to avoid php notice messages
{
$attr = array();
}
if( empty($attr['slug']) && !empty($attr['feed']) )
$attr['slug'] = $attr['feed'];
else if( empty($attr['slug']) && !empty($attr['channel']) )
$attr['slug'] = $attr['channel'];
else if( empty($attr['slug']) )
$attr['slug'] = 'podcast';
// Set empty args to prevent warnings
if( !isset($attr['term_taxonomy_id']) )
$attr['term_taxonomy_id'] = '';
if( !isset($attr['category_id']) )
$attr['category_id'] = '';
if( !isset($attr['post_type']) )
$attr['post_type'] = '';
$subscribe_type = '';
$category_id = '';
if(!empty($attr['category']) )
{
$CategoryObj = false;
if( preg_match('/^[0-9]*$/', $attr['category']) ) // If it is a numeric ID, lets try finding it by ID first...
$CategoryObj = get_term_by('id', $attr['category'], 'category');
if( empty($CategoryObj) )
$CategoryObj = get_term_by('name', $attr['category'], 'category');
if( empty($CategoryObj) )
$CategoryObj = get_term_by('slug', $attr['category'], 'category');
if( !empty($CategoryObj) )
{
$category_id = $CategoryObj->term_id;
}
}
if( !empty($attr['category']) )
$subscribe_type = 'category';
else if( !empty($attr['term_taxonomy_id']) )
$subscribe_type = 'ttid';
else if( !empty($attr['post_type']) )
$subscribe_type = 'post_type';
else if( empty($attr['post_type']) && !empty($attr['slug']) && $attr['slug'] != 'podcast' )
$subscribe_type = 'channel';
$Settings = array();
if( !empty($attr['feed_url']) )
{
$Settings['feed_url'] = $attr['feed_url'];
}
else
{
$Settings = powerpresssubscribe_get_settings( array('feed'=>$attr['slug'], 'taxonomy_term_id'=>$attr['term_taxonomy_id'], 'cat_id'=>$category_id, 'post_type'=>$attr['post_type'], 'subscribe_type'=>$subscribe_type), false );
}
// Podcast title handling
if( isset($attr['title']) && empty($attr['title']) && isset($Settings['title']) )
unset( $Settings['title'] ); // Special case, if the title is unset, then it should not be displayed
else if( !empty($attr['title']) )
$Settings['title'] = $attr['title'];
else if( !isset($Settings['title']) )
$Settings['title'] = ''; // This way the title can be detected
unset($Settings['subtitle']); // Make sure no subtitle passes this point
if( !empty($Settings['itunes_subtitle']) ) {
$Settings['subtitle'] = $Settings['itunes_subtitle'];
}
if (!empty($Settings['description'])) {
$Settings['subtitle'] = $Settings['description'];
}
if( !empty($attr['subtitle']) ) {
$Settings['subtitle'] = $attr['subtitle'];
}
if( !empty($attr['itunes_url']) )
$Settings['itunes_url'] = $attr['itunes_url'];
if( !empty($attr['subscribe_no_important_styling']) )
$Settings['subscribe_no_important_styling'] = $attr['subscribe_no_important_styling'];
if( !empty($attr['image_url']) )
$Settings['image_url'] = $attr['image_url'];
if( isset($attr['heading']) ) // If a custom heading is set
$Settings['heading'] = $attr['heading'];
if( empty($Settings) )
return '';
$Settings['itunes_url'] = powerpresssubscribe_get_itunes_url($Settings);
if (defined('WP_DEBUG')) {
if (WP_DEBUG) {
wp_enqueue_style('powerpress-subscribe-style-modern', plugin_dir_url(__FILE__) . 'css/subscribe.css', array(), POWERPRESS_VERSION);
} else {
wp_enqueue_style('powerpress-subscribe-style-modern', plugin_dir_url(__FILE__) . 'css/subscribe.min.css', array(), POWERPRESS_VERSION);
}
} else {
wp_enqueue_style('powerpress-subscribe-style-modern', plugin_dir_url(__FILE__) . 'css/subscribe.min.css', array(), POWERPRESS_VERSION);
}
if( !empty($attr['itunes_button']) && !empty($Settings['itunes_url']) )
{
$html = '<div>';
$html .= '';
$html .='<a href="';
$html .= esc_url($Settings['itunes_url']);
$html .= '" target="_blank" style="display:inline-block;overflow:hidden;background:url(https://linkmaker.itunes.apple.com/images/badges/en-us/badge_itunes-lrg.svg) no-repeat;width:165px;height:40px;"></a>';
$html .= '</div>';
return $html;
}
if( !empty($attr['itunes_badge']) && !empty($Settings['itunes_url']) )
{
$html = '<div>';
$html .= '';
$html .='<a href="';
$html .= esc_url($Settings['itunes_url']);
$html .= '" target="_blank" style="display:inline-block;overflow:hidden;background:url(https://linkmaker.itunes.apple.com/images/badges/en-us/badge_itunes-sm.svg) no-repeat;width:80px;height:15px;"></a>';
$html .= '</div>';
return $html;
}
if( !empty($attr['itunes_banner']) && !empty($Settings['itunes_url']) )
{
$apple_id = powerpress_get_apple_id($Settings['itunes_url'], true);
if( !empty($apple_id) && $apple_id > 0 )
{
$html = '';
$html .= '<div id="ibb-widget-root-'.$apple_id.'"></div>';
$html .= "<script>(function(t,e,i,d){var o=t.getElementById(i),n=t.createElement(e);o.style.height=250;o.style.width=300;o.style.display='inline-block';n.id='ibb-widget',n.setAttribute('src',('https:'===t.location.protocol?'https://':'http://')+d),n.setAttribute('width','300'),n.setAttribute('height','250'),n.setAttribute('frameborder','0'),n.setAttribute('scrolling','no'),o.appendChild(n)})(document,'iframe','ibb-widget-root-".$apple_id."'";
$html .= ',"banners.itunes.apple.com/banner.html?partnerId=&aId=&bt=catalog&t=catalog_blur&id='.$apple_id.'&c=us&l=en-US&w=300&h=250");</script>';
return $html;
}
return '';
}
// This is the only spot that gets the General settings for the subscribe buttons...
$PowerPressSettings = get_option('powerpress_general', array());
$Settings['subscribe_widget_shape'] = ( empty($PowerPressSettings['subscribe_widget_shape']) || $PowerPressSettings['subscribe_widget_shape'] == 'squared' ? '-sq': '');
$Settings['subscribe_no_important_styling'] = (!empty($PowerPressSettings['subscribe_no_important_styling']) ? $PowerPressSettings['subscribe_no_important_styling'] : '' );
return powerpress_do_subscribe_widget($Settings, $PowerPressSettings);
}
Code file location:
powerpress/powerpress/powerpress-subscribe.php
PowerPress Podcasting [ppn_shortcode] Shortcode
The PowerPress Plugin shortcode is designed to handle specific podcast network settings. It fetches network details, list IDs, and network titles from your WordPress options. It checks for attributes like ‘auto-active’, ‘terms-url’, and ‘default-list’, and sets them accordingly. It then makes an API request to fetch network lists, which are stored for later use. The shortcode ultimately returns an HTML form, populated with the fetched data, enhancing your podcast network’s functionality.
Shortcode: [ppn_shortcode]
Parameters
Here is a list of all possible ppn_shortcode shortcode parameters and attributes:
auto-active
– Activates the feature automatically when set to true.terms-url
– Sets the URL for the terms of service.default-list
– Determines the default list by its integer value.
Examples and Usage
Basic example – A simple usage of the PowerPress Network shortcode with auto-activation enabled. This will automatically activate the plugin upon usage.
[powerpress_network auto-active=true /]
Advanced examples
Usage of the PowerPress Network shortcode specifying a terms URL. This will display the terms and conditions of the network, linked to the specified URL.
[powerpress_network auto-active=true terms-url="http://example.com/terms" /]
Example of the shortcode that sets a default list. This list will be displayed by default when the plugin is activated.
[powerpress_network auto-active=true default-list=3 /]
Usage of the shortcode that combines all the parameters. This shortcode will activate the plugin, set the terms URL, and specify the default list all at once.
[powerpress_network auto-active=true terms-url="http://example.com/terms" default-list=3 /]
PHP Function Code
In case you have difficulties debugging what causing issues with [ppn_shortcode]
shortcode, check below the related PHP functions code.
Shortcode line:
add_shortcode($this->tag, [$this, 'ppn_shortcode']);
Shortcode PHP function:
function ppn_shortcode($attr, $contents)
{
require_once(WP_PLUGIN_DIR . '/powerpress/powerpressadmin.php');
$props = array();
if ( !empty($attr['auto-active']) ) {
$props['auto-active'] = (bool)true;
}
if ( isset($attr['terms-url']) ) {
$props['terms-url'] = (string)$attr['terms-url'];
}
if ( isset($attr['default-list']) ) {
$props['default-list'] = (int)$attr['default-list'];
}
$props['network_general'] = get_option('network_general');
$props['powerpress_network'] = get_option('powerpress_network');
if (isset($props['powerpress_network']['list_id'])){
$listID = $props['powerpress_network']['list_id'];
}
$networkID = get_option('powerpress_network_id');
$networkTitle = get_option('powerpress_network_title');
$props['powerpress_network']['network_id'] = $networkID;
$props['powerpress_network']['network_title'] = $networkTitle;
$post = false;
$requestUrl = '/2/powerpress/network/'.$networkID.'/lists/';
$results = $GLOBALS['ppn_object']->requestAPI($requestUrl, true, $post);
$props['post'] = $post;
$props['lists'] = $results;
//$props['apiUrl'] = $apiUrl;
if (!isset($null)){
$null = null;
}
return PowerPressNetwork::getHTML('forms.php', $props, null, null);
}
Code file location:
powerpress/powerpress/shortcodes/ShortCode.php
Conclusion
Now that you’ve learned how to embed the PowerPress Podcasting by Blubrry Plugin shortcodes, understood the parameters, and seen code examples, it’s easy to use and debug any issue that might cause it to ‘not work’. If you still have difficulties with it, don’t hesitate to leave a comment below.
Leave a Reply