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

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

android - IBM Worklight 6.1 [Application Error] There was a network error (file:///android_asset/www/index.html) -