Skip Navigation

[Resolved] Getting the results of a PHP function into a shortcode, etc. for use in Views

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

This topic contains 1 reply, has 2 voices.

Last updated by Luo Yang 1 year, 11 months ago.

Assigned support staff: Luo Yang.

Author
Posts
#1365615

I have a client who uses the PowerPress plugin to manage their Podcast. One of the fields filled in for this plugin on each post is a URL to the MP3 file. The only way it seems I can retrieve the URL entered into this field programmatically is via a PHP function in my functions.php file. The code they provide is:

function powerpress_podcast_url( $EpisodeData ) {
if( function_exists('powerpress_get_enclosure_data') ) {
$EpisodeData = powerpress_get_enclosure_data( get_the_ID() );
if( !empty($EpisodeData['url']) ) {
return htmlspecialchars($EpisodeData['url']);
}
}
}

So, if I were to enter "echo powerpress_url(25980);" in a page template file, I would get something like => hidden link

I need help getting this function into a form that I can use in Views. I've read the shortcode links you have on your site but I just can't figure it out.

#1366009

Luo Yang
Supporter

Languages: English (English ) Chinese (Simplified) (简体中文 )

Timezone: Asia/Hong_Kong (GMT+08:00)

Hello,

There isn't such kind of built-in feature within Toolset, it depends on the PowerPress plugin you mentioned above.

I suggest you check it with author of PowerPress plugin, check if there is any shortcode to display the URL of MP3 file, then you can put this shortcode into Views content, see WordPress document:
https://codex.wordpress.org/Function_Reference/add_shortcode
Adds a hook for a shortcode tag.