Branduo Branduo - 3 years ago 57
PHP Question

Trying to write a PHP if/else statement but failing miserably can anyone help me out?

So I'm trying to make a if/else statement in PHP, I have the if statement down and it's returning what I want, but I can't seem to figure out the else statement. Does anyone have any ideas?

<div class="row">
<?php while($items->have_posts()) : $items->the_post(); ?>


if( get_field('sauce_or_spice') ): ?>
<div class="large-4 medium-6 columns">
<h5><?php the_title(); ?></h5>
<a href="" ?>
<div class="thumbnail products">
<?php the_post_thumbnail('thumbnail'); ?>
<p><?php the_field('description'); ?></p>
<p><?php the_field('price'); ?></p>
<a class="video-button">Buy now!</a>
<?php elseif( get_field(!('sauce_or_spice')) ): ?>
<?php echo'HELLO'; ?>
<?php endif; ?>
<?php endwhile;?>

Answer Source

I think you want <?php elseif( !get_field('sauce_or_spice') ): ?>

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download