Title: [Plugin: Audio Player] Custom fields in player code
Last modified: August 19, 2016

---

# [Plugin: Audio Player] Custom fields in player code

 *  Resolved [alekseygr](https://wordpress.org/support/users/alekseygr/)
 * (@alekseygr)
 * [15 years, 3 months ago](https://wordpress.org/support/topic/plugin-audio-player-custom-fields-in-player-code/)
 * Hello.
 * Can anybody tell – how can I add custom field value in player code?
 * So, I have code like:
 *     ```
       <?php if (function_exists("insert_audio_player")) {insert_audio_player("[audio:|titles=]"} ?>
       ```
   
 * I need to make something like this to work at my website:
 *     ```
       <?php if (function_exists("insert_audio_player")) {insert_audio_player("[audio:custom_field_1|titles=custom_field_2]"} ?>
       ```
   
 * My main trouble is the way, I print custom fields in my template:
 *     ```
       <?php print_custom_field('tc_filename'); ?>
       ```
   
 * How can I add this to first example? Any ideas? It’s very simple, I know, but
   I’m a beginner in PHP and trying to learn it right now.
 * Thanks.

Viewing 1 replies (of 1 total)

 *  Thread Starter [alekseygr](https://wordpress.org/support/users/alekseygr/)
 * (@alekseygr)
 * [15 years, 3 months ago](https://wordpress.org/support/topic/plugin-audio-player-custom-fields-in-player-code/#post-1976310)
 * Have the solution. Thanks for [@jacob](https://wordpress.org/support/users/jacob/)
   and @jnpcl from stackoverflow.
    Need to use this code:
 *     ```
       <?php
       if (function_exists("insert_audio_player")) {
           insert_audio_player(sprintf(
               '[audio:%s|titles=%s]',
               get_custom_field('tc_filename'),
               get_custom_field('tc_title')
           ));
       }
       ?>
       ```
   

Viewing 1 replies (of 1 total)

The topic ‘[Plugin: Audio Player] Custom fields in player code’ is closed to new
replies.

 * ![](https://s.w.org/plugins/geopattern-icon/audio-player.svg)
 * [Audio Player](https://wordpress.org/plugins/audio-player/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/audio-player/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/audio-player/)
 * [Active Topics](https://wordpress.org/support/plugin/audio-player/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/audio-player/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/audio-player/reviews/)

 * 1 reply
 * 1 participant
 * Last reply from: [alekseygr](https://wordpress.org/support/users/alekseygr/)
 * Last activity: [15 years, 3 months ago](https://wordpress.org/support/topic/plugin-audio-player-custom-fields-in-player-code/#post-1976310)
 * Status: resolved