Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/wordpress/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 回显显示URL的短代码,而不是执行短代码_Php_Wordpress_Shortcode_Advanced Custom Fields - Fatal编程技术网

Php 回显显示URL的短代码,而不是执行短代码

Php 回显显示URL的短代码,而不是执行短代码,php,wordpress,shortcode,advanced-custom-fields,Php,Wordpress,Shortcode,Advanced Custom Fields,我正在使用WordPress的高级自定义字段插件的repeater字段来显示歌曲名称,并在相关的地方提供一个使用Compact Audio插件播放的示例 我正在使用echo shortcode函数,这在一定程度上是有效的-但是,它实际上并没有执行shortcode,而是显示文件URL(这是字段“礼仪样本”的值)。我在其他网站上也使用过它(尽管不在repeater字段中——这是与字段名的唯一区别)。谁能告诉我怎么解决这个问题吗 以下是我遇到问题的页面: 代码如下: <?php // che

我正在使用WordPress的高级自定义字段插件的repeater字段来显示歌曲名称,并在相关的地方提供一个使用Compact Audio插件播放的示例

我正在使用
echo shortcode
函数,这在一定程度上是有效的-但是,它实际上并没有执行shortcode,而是显示文件URL(这是字段“礼仪样本”的值)。我在其他网站上也使用过它(尽管不在repeater字段中——这是与字段名的唯一区别)。谁能告诉我怎么解决这个问题吗

以下是我遇到问题的页面:

代码如下:

<?php

// check if the repeater field has rows of data
if( have_rows('ceremonial') ):

    // loop through the rows of data
    while ( have_rows('ceremonial') ) : the_row();

        // display a sub field value
        echo '<div class="song">';

    the_sub_field('ceremonial_song');

        echo '<div class="sample">';


if(the_sub_field('ceremonial_sample') ):
echo
do_shortcode( '[sc_embed_player fileurl="'.the_sub_field( 'ceremonial_sample' ).'"]' );
endif;


    echo '</div>';

    echo '</div>';

    endwhile;

else :

    // no rows found

endif;

?>

如何分配子字段(“礼仪样本”);改为一个变量,而不是执行if(_sub_字段,即:$sample=_sub_字段('ceremonal_sample'));然后做一个检查,并在短代码中使用该变量,我认为该字段必须有一个打印或回显,它只是回显到页面上,真诚的问题:我确实阅读了文档,但它没有像我这样具体的查询的答案。我总是尝试自己解决问题,并在之前阅读文档问问题,但在这种情况下,我找不到答案。