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 'http://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 (http://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>http://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 (
, 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="http://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?

Read more here: Audio link assembled in custom post type using ECPT shortcode does not render player on front end


If you know the solution of this issue, please leave us a reply in Comment section, to update the question.

Related Wordpress search:

, , , , , , , , , ,

Wordpress related questions and answers: