Using Shortcode in Custom Fields
I have an audio/video player that uses shortcodes to display the player. In the theme I am using the code for audio/video players is suppose to be entered in a custom field. I need to be able to have shortcodes parsed in this specific custom field in my theme. This is the isolated portion of the code in my single.php that calls on the custom field that I am dealing with:
<div class="entry"> <?php $video_code = thman_getcustomfield('video_code',get_the_ID()); if(!empty($video_code)) : ?><div class="video_code"><?php echo $video_code; ?></div><?php endif; ?>
I need this section to check if the video_code field contains shortcode and if so parse the shortcode so that it will be processed and appear in the post as it would if the shortcode was inserted in the editor. If not then just process as normal.
I have tried several different fixes from various forums to get this to work. I am in great need of some
- The topic ‘Using Shortcode in Custom Fields’ is closed to new replies.