I am new to ACF and PHP, I am getting an error, but I am not sure what I am doing wrong.
<!--BANNER STATIC OR SLIDESHOW LAYOUT-->
<?php if(get_row_layout() == 'banner'): // layout: Content ?>
<section class="banner">
<?php
$sbimage = get_field('static_banner'); // Array returned by Advanced Custom Fields
$sbimageAlt = $sbimage['alt']; // Grab, from the array, the 'alt'
$sbimageWidth = $sbimage['width']; // Grab, from the array, the 'width'
$sbimageHeight = $sbimage['height']; // Grab, from the array, the 'height'
$sbimageThumbURL = $sbimage['sizes']['large']; //grab from the array, the 'sizes', and from it, the 'thumbnail'
?>
<?php if(get_field('static_banner')): ?>
<a href="<?php the_field('static_url'); ?>">
<img src="<?php echo $sbimageThumbURL;?>" alt="<?php echo $sbimageAlt; ?>" width="<?php echo $sbimageWidth; ?>" height="<?php echo $sbimageHeight; ?>" /></a>
</section>
<?php else: ?>
<section class="banner">
<?php the_field('slideshow_banner'); ?>
</section>
<?php endif; ?>
Aucun commentaire:
Enregistrer un commentaire