将值传递给wordpress短代码

时间:2016-05-31 11:01:48

标签: php wordpress-plugin

<?php while (have_rows('home_playlist', 'option')): the_row();
$track = get_sub_field('home_track'); ?>
echo $track;

这里echo从wp面板生成一些选择性ID 2,4,7,10,12(mp3歌曲标题)。我需要在播放器上显示标题。如何将$ track的值传递给'ids'....

1 个答案:

答案 0 :(得分:0)

<?php 
$tracks=array();
while (have_rows('home_playlist', 'option')): the_row();
    $tracks[] = get_sub_field('home_track'); ?>
$list= implode(',',$tracks);
echo $list;
mp3j_put( '[popout ids="'.$list.'" autoplay="y"]' ); ?>