我试图在下面的短代码中显示/插入一个url:
<?php echo do_shortcode('[sc_embed_player fileurl="http://www.example.com/wp-content/uploads/my-music/mysong.mp3"]'); ?>我使用的是一个名为"add_audio“的ACF字段,它是一个mp3 URL。
我使用默认的get字段( <?php the_field('field_name'); ?> )代码来调用url。
我也做了一个变量,并调用($variable)。
但什么都没用!!
这是我得到的错误
"Prase error :第43行/app/public/wp-content/oxygen/component-framework/components/layouts/code-block.php(33):eval()'d代码中的语法错误、意外的'add_audio'(T_STRING)、预期的‘或’‘“
我使用了Oxygenbuilder插件和ACF插件。
<?php
/*
* Easy Query Shortcode
* [easy_query container="div" template="template_906184" posts_per_page="20" post_type="audio_files"]
*/
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$args = array(
'post_type' => array('audio_files'),
'post_status' => 'publish',
'order' => 'DESC',
'orderby' => 'date',
'posts_per_page' => 20,
'paged' => $paged,
);
// WP_Query
$eq_query = new WP_Query( $args );
if ($eq_query->have_posts()) : // The Loop
$eq_count = 0;
?>
<div class="wp-easy-query paging-style-default grey">
<div class="wp-easy-query-posts">
<div>
<?php
while ($eq_query->have_posts()): $eq_query->the_post();
$eq_count++;
?>
<div id="div_block-17-25" class="ct-div-block audio-div">
<h1 id="headline-18-25" class="ct-headline">
<?php the_title(); ?></h1>
<div id="div_block-20-25" class="ct-div-block">
<?php echo do_shortcode('[sc_embed_player_template1 fileurl="<?php the_field('add_audio'); ?>"]'); ?>
</div>
</div>
<?php endwhile; wp_reset_query(); ?>
</div>
</div>
<?php include(EQ_PAGING); ?>
</div>
<?php endif; ?>发布于 2019-04-29 06:18:53
只需尝试从代码中删除它,如下所示:
<?php echo do_shortcode('[sc_embed_player_template1 fileurl="'.the_field('add_audio').'"]'); ?>https://stackoverflow.com/questions/55891879
复制相似问题