Support

Account

Forum Replies Created

  • Any fix for collapsing Group fields? Thanks

  • Resolved! Of course my own fault. I have a custom themed ACF backend that inadvertently hid the Add Field button at the bottom of the layout fields so I assumed the Add Field button on the top was the way to add fields to the layout.
    Anyway my ignorance may help someone else. Glad it was my fault tbh 🙂

  • Found the issue. I was trying to call WP posts in a <?php elseif( get_row_layout() == 'featured_news' ): ?>

    
    <?php
    $tags = get_sub_field('tags');
    $args = array(
    'post_type' => 'post',
    'post_status' => 'publish',
    'tag' => $tags,
    'posts_per_page' => 5,
    );
    $arr_posts = new WP_Query( $args );
    if ( $arr_posts->have_posts() ) :
    while ( $arr_posts->have_posts() ) :
    $arr_posts->the_post();
    ?>	
    ...output
    <?php
    endwhile; 
    endif;
    ?>
    

    but needed to have wp_reset_postdata(); at the bottom like:

    
    <?php
    $tags = get_sub_field('tags');
    $args = array(
    'post_type' => 'post',
    'post_status' => 'publish',
    'tag' => $tags,
    'posts_per_page' => 5,
    );
    $arr_posts = new WP_Query( $args );
    if ( $arr_posts->have_posts() ) :
    while ( $arr_posts->have_posts() ) :
    $arr_posts->the_post();
    ?>	
    ...output
    <?php
    endwhile;
    wp_reset_postdata(); <=NEEDED THIS
    endif;
    ?>

    May help someone else

  • My code is a series of if statements in a while loop. I’m not using any elseif

    <?php if( have_rows('universal') ): ?>
        <?php while( have_rows('universal') ): the_row(); ?>
    
            <?php if( get_row_layout() == 'text' ): ?>  
            //output
            <?php endif; ?>
    
             <?php  if( get_row_layout() == 'cards' ): ?>
             //output
             <?php endif; ?>
    
              + 6 more of these each querying a different layout
    
        <?php endwhile; ?>
    <?php endif; ?>
Viewing 4 posts - 1 through 4 (of 4 total)