Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save samediamba/1edd394ede27dc29cb80 to your computer and use it in GitHub Desktop.
Save samediamba/1edd394ede27dc29cb80 to your computer and use it in GitHub Desktop.
<?php
/**
* Home Slider
*
* Uses the Genesis Responsive slider combined with Advanaced Custom Fields
* setting in Dashboard - Instellingen website
*/
function rrwd_home_slider() {
global $wpdb;
if ( !get_field( 'rrwd_acf_slider', 'option' ) ) return;
?>
<div id="genesis-responsive-slider">
<div class="flexslider">
<ul class="slides">
<?php
while( has_sub_field('rrwd_acf_slider', 'option') ) {
$image_obj = get_sub_field('rrwd_acf_slider_image', 'option');
$url = $image_obj['url'];
$link = get_sub_field('rrwd_acf_slider_link', 'option');
$alt = get_sub_field('rrwd_acf_slider_alt', 'option');
?>
<li>
<div class="slide-image">
<?php
if ( !$link ) {
?>
<img src="<?php echo $url ?>" alt="<?php echo $alt; ?>" />
<?php
} else {
?>
<a href="<?php echo $link ?>" rel="bookmark"><img src="<?php echo $url ?>" alt="<?php echo $alt; ?>" /></a>
<?php
}
?>
</div><!-- end .slide-image -->
</li>
<?php } ?>
</ul><!-- end ul.slides -->
</div><!-- end .flexslider -->
</div><!-- end #genesis-responsive-slider -->
<?php
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment