Support

Account

Home Forums ACF PRO True / False fields break the site

Solved

True / False fields break the site

  • Hello,

    I have the following code:

    <?php if ( have_rows( '1st_day_match' ) ) : ?>
    														<?php while ( have_rows( '1st_day_match' ) ) : the_row(); ?>
    															<?php the_sub_field( 'match_date' ); ?>
    															<?php if ( have_rows( 'match_line_1' ) ) : ?>
    																<?php while ( have_rows( 'match_line_1' ) ) : the_row(); ?>
    																	<?php if ( get_sub_field( 'change_field_1' ) == 1 ) { 
    																	 // echo 'true'; 
    																	} else { 
    																	 // echo 'false'; 
    																	} ?>
    																	<?php the_sub_field( 'change_field_name_1' ); ?>
    																	<?php if ( get_sub_field( 'is_it_final_or_semi_final_1' ) == 1 ) { 
    																	 // echo 'true'; 
    																	} else { 
    																	 // echo 'false'; 
    																	} ?>
    																	<?php the_sub_field( 'final_or_semifinal_1' ); ?>
    																	<?php the_sub_field( 'match_time' ); ?>
    																	<?php the_sub_field( 'team_1' ); ?>
    																	<?php the_sub_field( 'score_1' ); ?>
    																	<?php the_sub_field( 'score_2' ); ?>
    																	<?php the_sub_field( 'team_2' ); ?>
    																	<?php the_sub_field( 'omilos' ); ?>
    																<?php endwhile; ?>
    															<?php else : ?>
    																<?php // no rows found ?>
    															<?php endif; ?>
    														<?php endwhile; ?>
    													<?php endif; ?>

    I found that the code that breaks the website is the 2 parts which contain the true/false statements:

    <?php if ( get_sub_field( 'change_field_1' ) == 1 ) { 
    																	 // echo 'true'; 
    																	} else { 
    																	 // echo 'false'; 
    																	} ?>
    																	<?php if ( get_sub_field( 'is_it_final_or_semi_final_1' ) == 1 ) { 
    																	 // echo 'true'; 
    																	} else { 
    																	 // echo 'false'; 
    																	} ?>

    Is there any problem with the code? I have tried everything and really cannot figure it out. It might be obvious and I’m missing it or something.

  • What do you mean by “breaks the website”? What is it doing that it shouldn’t be doing?

    I don’t see any errors in the code as written.

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.