if statement - PHP if else issue -
i'm sure simple, can't if else not break page:
<?php $values = get_field('testimonial_text'); if($values) { echo ' <div class="testimonial entry-content"> <h2><?php the_field('testimonial_title'); ?></h2> <?php the_field('testimonial_text'); ?> </div>'; } else { echo ''; } ?>
can show me did wrong , why did isn't working。
you have nested <?php .. ?>
blocks. that's sign wrong!
<?php $values = get_field('testimonial_text'); if($values) { echo '<div class="testimonial entry-content">'; echo '<h2>'; the_field('testimonial_title'); echo '</h2>'; the_field('testimonial_text'); echo '</div>'; } // else no-op, removed ?>
Comments
Post a Comment