Reputation: 1
I'm trying to display/insert a url into the shortcode below:
<?php echo do_shortcode('[sc_embed_player fileurl="http://www.example.com/wp-content/uploads/my-music/mysong.mp3"]'); ?>
I'm using a ACF field called "add_audio" which is a mp3 URL.
I used the default get field ( <?php the_field('field_name'); ?>
)
code to call the the url.
I made a variable too and called ($variable) too.
But nothing worked!!
Here's the error i get
"Prase error:syntax error, unexpected 'add_audio'(T_STRING), expecting,''or')'in /app/public/wp-content/oxygen/component-framework/components/layouts/code-block.php(33):eval()'d code on line 43"
I used Oxygenbuilder plugin and ACF plugins.
<?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; ?>
Upvotes: 0
Views: 609
Reputation: 593
Simply Try Removing from your Code write it as follows:
<?php echo do_shortcode('[sc_embed_player_template1 fileurl="'.the_field('add_audio').'"]'); ?>
Upvotes: 1