Support

Account

Home Forums ACF PRO flexible content show more rows on buttonclick

Unread

flexible content show more rows on buttonclick

  • Hi,

    i’va created a 2 column grid with acf flexible content called “grid-start”. My php looks like this:

    <?php
    
    // check if the flexible content field has rows of data
    if( have_rows('grid-start','48') ):?>
    
        <?php while ( have_rows('grid-start','48') ) : the_row(); 
          $post_objectsright = get_sub_field('content-1');
          $post_objectsleft = get_sub_field('content-2'); ?>
    
            <?php if( get_row_layout() == 'row' ):   
              ?>
    
     <?php
         
          
          if( $post_objectsright ): 
          
            // override $post
            $post = $post_objectsright;
            setup_postdata( $post );
            $backgroundImg = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'full' ); 
          
            $positionBildKachel = get_post_meta(get_the_ID(), '_positionKachelBild', true);
          $verlinkung = get_field('verlinkung-detailseite');
          
              $post_id    = get_the_id();
           $imageDesktop = get_field('desktop_bild');
          $imageMobile = get_field('mobil_bild')
          
          
            ?>
    
      <?php get_template_part( 'partials/halfwidthPost' ); ?>
         
         
    
    <?php get_template_part( 'partials/modal' ); ?>
    
       <?php wp_reset_postdata(); ?>
       <?php endif; ?>
    
    <?php
         
         
          if( $post_objectsleft ): 
          
            // override $post
            $post = $post_objectsleft;
            setup_postdata( $post );
            $backgroundImg = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'full' ); 
          
            $positionBildKachel = get_post_meta(get_the_ID(), '_positionKachelBild', true);
          $verlinkung = get_field('verlinkung-detailseite');
          
              $post_id    = get_the_id();
           $imageDesktop = get_field('desktop_bild');
          $imageMobile = get_field('mobil_bild')
          
          
            ?>
    
      <?php get_template_part( 'partials/halfwidthPost' ); ?>
         
    
    <?php get_template_part( 'partials/modal' ); ?>
    
       <?php wp_reset_postdata(); ?>
       <?php endif; ?>
    
             <?php endif; ?>
    
         <?php endwhile; ?>
    
     <?php else : ?>
    
       
    
     <?php endif; ?>

    as you can see, i show pots in both of the columns in a partial called “halfwidthPost”. ( just for a better overview )

    My question: How can i show just the first 3 rows and on buttonclick the next 3 and so on. Thanks for your help

    greetings

Viewing 1 post (of 1 total)

The topic ‘flexible content show more rows on buttonclick’ is closed to new replies.