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.
The topic ‘True / False fields break the site’ is closed to new replies.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.