I have set up Flexslider using the ACF gallery field
Using the instructions Create a carousel / slider http://www.advancedcustomfields.com/resources/field-types/gallery/
What do I need to change to retrieve images hosted on another server?
The following code is what works using the explode()
function. How is it possible to combine echo
for an unknown number of URLs?
<div id="slider" class="flexslider">
<ul class="slides">
<?php
$string = get_field( 'other' );
$split = explode ( '|', $string );
echo "<li><img src='{$split[0]}' /></li>";
echo "<li><img src='{$split[1]}' /></li>";
echo "<li><img src='{$split[2]}' /></li>";
echo "<li><img src='{$split[3]}' /></li>";
var_dump(the_field( 'other' ));
?>
</ul>
</div>
For anyone wanting to loop images from another source using Flexslider.
I created a ‘text area’ field type and split the urls with a pipe (|).
www.domain.com/img/01.jpg|www.domain.com/img/02.jpg|www.domain.com/img/03.jpg
<div id="slider" class="flexslider">
<ul class="slides">
<?php
$string = get_field( 'slider' );
$split = explode ( '|', $string );
$split = array_reverse($split);
foreach($split as $img){
echo "<li><img src='{$img}' /></li>";
}
?>
</ul>
</div>
Remove $split = array_reverse($split);
for normal order.