I'm using Easing Slider Pro for slideshows and Advanced Custom Fields to build a custom page layout. I can't figure out why the ACF & Easing PHP only outputs the ID number of the slider I want to insert into a page, not the slider itself.
I found this old thread, which has the same problem but it's for regular ACF, not a flexible content field: Wordpress PHP within PHP -- also, the recommended ES output code has changed a bit, like slider 159 would look like:
<?php if ( function_exists( 'easingslider' ) ) { easingslider( 159 ); } ?>
Here's my code, which works fine for photos and texts:
<?php while(the_flexible_field('flex_field')): ?>
<?php if(get_row_layout() == 'photo'): ?>
<div class="col-md-6">
<h2>Photos</h2>
<img src='<?php the_sub_field('photo-stack_image'); ?>' class="img-responsive" />
<BR><BR>
<img src='<?php the_sub_field('photo-stack_image2'); ?>' class="img-responsive" />
</div>
<?php elseif( get_row_layout() == 'text' ): ?>
<div class="col-md-6">
<h2>Texts</h2>
<?php the_sub_field('text_field');?>
</div>
<?php elseif(get_row_layout() == 'slider'): ?>
<div class="col-md-6">
<h2>Sliders</h2>
<?php if ( function_exists( 'easingslider' ) )
{ easingslider( the_sub_field('easing_slider_shortcode') ); } ?>
</div>
<?php endif; ?>
<?php endwhile; ?>
I've tried switching the_sub_field with get_sub_field but that doesn't even output the ID. I'm new-ish to PHP and wouldn't be surprised to learn that I missed something simple, but what? Thanks in advance!
Update: Thanks Hobo! Per your suggestions, I tested the ES function (it works), and found that both "echo get_sub_field('easing_slider_shortcode')" and "print_r(get_sub_field('easing_slider_shortcode'))" brought back just the ID number of the slider, with no additional code. I've double checked the names of the flex field, field and subfield and they're all correct.
I don't know if this helps suggests what the problem is, but I added the PHP code around the ES ID number via ACF's admin-side prepend and append feature, but it didn't echo out the code on the page.
Update Two That second try did the trick -- thanks Hobo! Here's my final code if anyone has this problem in the future:
<div class="col-md-6">
<?php elseif(get_row_layout() == 'slider'): ?>
<?php if ( function_exists( 'easingslider' ) ) {
$slider_id = (int) get_sub_field('easing_slider_shortcode');
easingslider( $slider_id );
} ?>