Support

Account

Forum Replies Created

  • I need another piece of help related to this code snippet.

    I need to be able to add a header above this code snippet which has to be conditional based on having rows. I cannot have it in the ‘while’ section as the while loops through all the rows, not just the ones marked ‘functional assay.’

    For the time being I have done this:

    <?php
    if(have_rows('field_name')):
       while(have_rows('field_name')): the_row();
          if(get_sub_field('sub_field') == 'functional assay'):
             echo '<h4 class="underline">Functional Assay</h4>';
    break;
          endif;
       endwhile;
    endif;
    ?>
    
    <?php
    if(have_rows('field_name')):
       while(have_rows('field_name')): the_row();
          if(get_sub_field('sub_field') == 'functional assay'):
             the_sub_field('sub_field');
          endif;
       endwhile;
    endif;
    ?>

    I’m using the repeater loop twice, and the first instance is basically a check for rows, shows the title then breaks after the first row to not show the title multiple times.I feel this could be done in a much cleaner way, but I am not sure how.

  • Thanks for the help gentlemen! For some reason I decided this was a difficult problem and overlooked the simplest solution.

  • Thank you for responding and sorry for not explaining the question well enough.

    I am only looking to loop through the sub field and show only the rows that contain the value of ‘functional assay’ within the ‘application’ sub field.

  • Thanks. Looks like it was not an ACF issue, so I appreciate the help!

    I found this in the debug:

    [02-Jul-2015 17:29:49 UTC] PHP Fatal error: Maximum execution time of 30 seconds exceeded in /public/wp-includes/post.php on line 2096

    and adjusted the max execution time to allow for the full page to load.

  • Thanks for that! I did end up using something quite similar.

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