php help: want to echo a custom vield value within an echo shortcode in template
-
I created a custom field for my posts called soundclip1. It’s a url for an uploaded mp3 file.
I want to call that custom field (called soundclip1) within a sound player shortcode in my template.
This is the shortcode:
[sc_embed_player fileurl="URL OF THE MP3 FILE"]
This is the shortcode as php in the template
<?php echo do_shortcode('[sc_embed_player fileurl="URL OF THE MP3 FILE"]'); ?>
Here is my attempt that is not working.
<?php $soundclip1 = get_post_meta($post->ID, 'soundclip1', true); if( $soundclip1 ) echo do_shortcode('[sc_embed_player fileurl="' . $soundclip1 . '"]'); ?>
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘php help: want to echo a custom vield value within an echo shortcode in template’ is closed to new replies.