• Resolved alekseygr

    (@alekseygr)


    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

    (@alekseygr)

    Have the solution. Thanks for @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.