Show Gallery Image As Slider And Add Class

<?php $images2 = get_field(‘slider_gallery’,$post->ID); $count=1;
if( $images2 ):
$counter = 0;
?>

<?php foreach( $images2 as $image2 ): ?>
<?php $class = ”;
if(++$counter == 1) {
$class = ‘active’;
}
else {
$class == ”;
}

?>

<?php echo $class ; ?>”>

“<?php echo $image2[‘slider_image’]; ?>” alt=”” />

<h4><?php echo $image2[‘slider_heading’]; ?></h4>
<p><?php echo $image2[‘slider_text’]; ?></p>

<?php endforeach; ?>
<?php endif; ?>

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Create a free website or blog at WordPress.com.

Up ↑

%d bloggers like this: