Skip Navigation

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

This support ticket is created vor 4 Jahre, 5 Monate. There's a good chance that you are reading advice that it now obsolete.

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.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

This topic contains 1 Antwort, has 2 Stimmen.

Last updated by Luo Yang vor 4 Jahre, 5 Monate.

Assisted by: Luo Yang.

Author
Artikel
#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

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.

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.