Support

Account

Home Forums Add-ons Flexible Content Field Pagination Reply To: Pagination

  • I’ll try to explain but I’m not an expert in php. I do not know if I did it right but it works. I ended up using the elliot’s solution and it works well.

    1. i create a field “break”;

    2. Before the loop “while” i get the page create a counter variable which starts at 1 and gets increased each time the “break” layout is used like elliot says :

    <?php  $paged = (get_query_var('page')) ? get_query_var('page') : 1; 
            $MyContent = " " ;//variable for <!--nextpage-->
            $count =1; ?>

    3. Then the loop

    <?php while(has_sub_field("content")): ?>
    
      <?php if(get_row_layout() == "break"):  ?>
        <?php $MyContent .= "<!--nextpage-->\n";          
              $count++; ?>
      <?php endif; ?>
    
      <?php if(get_row_layout() == "section_content"):  ?>
          <?php if ($count != $paged){
    	continue; //ignore the current loop’s layout. 
          }?>
        //your content
    <?php endif; ?>
    <?php endwhile; ?>
    ///after the loop put pagination
    <?php 	global $post;
            $post->post_content = $MyContent;
    	setup_postdata($post);
    
    	 wp_link_pages(); 
    ?>

    Sorry for my english, i hope that help you