Created
February 13, 2014 09:58
-
-
Save rianrietveld/8972557 to your computer and use it in GitHub Desktop.
Custom Output for Genesis Responsive slider combined with Advanaced Custom Fields
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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