Audio shortcode or URL in custom post tremplate not rendering
-
I’m trying to get an audio player to display correctly in a WP custom post type, using a value from one of the meta fields and assembling the audio URL as follows:
//output the audio link using ecpt_vnc_username function demo_audio_link () { echo 'https://download.virtualnewscenter.com/demos/' . do_shortcode('[ecpt_field id="anchor_username"]') . '.mp3'; } add_action( 'genesis_entry_header', 'demo_audio_link', 11 );
for anchor_username=aspector, the post renders the URL literally (
https://download.virtualnewscenter.com/demos/aspector.mp3
) rather than as an audio player.Page source looks like this:
<header class="entry-header"><h1 class="entry-title" itemprop="headline">Alan Spector</h1>https://download.virtualnewscenter.com/demos/aspector.mp3<p class="entry-meta">
I’ve tried various incantations of print, printf and echo, including the audio shortcode in what is echo’d (
[audio src="https://download.virtualnewscenter.com/demos/aspector.mp3"]
, single vs. double quotes, and hard-coding the audio player as<audio class="wp-audio-shortcode" preload="none" style="width: 100%; visibility: hidden;" controls="controls"><source type="audio/mpeg" src="https://download.virtualnewscenter.com/demos/aspector.mp3"/></audio><br/>
All of them end up with the literal outputting to the page, not being handled by the WP parsing to either a link or an audio player.
What am I missing?
- The topic ‘Audio shortcode or URL in custom post tremplate not rendering’ is closed to new replies.