Hi there,
1. shortcodes within shortcodes will not work. WordPress does not support this.
2. Podcast player does support custom field for feed URL. You just need to do following,
[podcastplayer feed_url="acf_field_name"]
3. subscription option does not support ACF field. However, we need some custom solution for this.
Inform me for more help on this.
Thanks,
Hi @dazman88 ,
I have created a custom function for you to fetch spotify, apple and google links from ACF fields.
1. Copy and paste following PHP function in code snippets free plugin. You can also paste it at the end of your theme’s function.php file but it is lot more complicated and unsafe.
add_filter(
'podcast_player_shcode_display',
function( $args ) {
$temp = array(
'apple-sub' => $args['apple-sub'],
'google-sub' => $args['google-sub'],
'spotify-sub' => $args['spotify-sub'],
);
foreach ( $temp as $key => $val ) {
$scheme = strtolower( wp_parse_url( $val, PHP_URL_SCHEME ) );
if ( in_array( $scheme, array( 'http', 'https' ), true ) ) {
continue;
}
// Check if url has been provided in as a custom field.
$custom_keys = get_post_custom_keys();
if ( $custom_keys && in_array( $val, $custom_keys, true ) ) {
$murl = get_post_custom_values( $val );
$murl = is_array( $murl ) ? $murl[0] : $murl;
$scheme1 = strtolower( wp_parse_url( $murl, PHP_URL_SCHEME ) );
if ( in_array( $scheme1, array( 'http', 'https' ), true ) ) {
$args[ $key ] = wp_strip_all_tags( $murl );
}
}
}
return $args;
},
12
);
2. Now let’s assume your ACF field name are as follows, acf_url, acf_apple, acf_google, acf_spotify. You can create a shortcode like this,
[podcastplayer feed_url="acf_url" spotify_sub="acf_spotify" google_sub="acf_google" apple_sub="acf_apple"]
You need to use actual acf filed name here.
Note: Using custom PHP code might break your site if pasted incorrectly. Please backup your site and use code snippet plugin to do it safely.
Hi @dazman88 ,
Did the above solution work for you? Do you need any more help?
Thanks,
Hi there,
I hope the issue has been resolved. Therefore, I am closing the ticket. However, feel free to comment on this ticket or create a new ticket if you need any more help with podcast player.
Thanks,