admin管理员组

文章数量:1122846

 <?php
 $inner_page_builder = get_field("inner_page_builder_modules"); //group field
    if ($inner_page_builder) {
        $main_content = $inner_page_builder["main_content"]; //flexible content field
    ?>
        <div class="container">
            <div class="main-content">
    
                <?php
                echo "<pre>" . var_dump($main_content) . "</pre>"; // gives me below output:
                /*
    
                array(2) {
      [0]=&gt;
      array(2) {
        ["acf_fc_layout"]=&gt;
        string(9) "text_copy"
        ["text"]=&gt;
        string(330) "<p>You know discne focus. All day. Every day. At every implementation. Because focus drives excellence</p>
    "
      }
      [1]=&gt;
      array(5) {
        ["acf_fc_layout"]=&gt;
        string(10) "inline_cta"
        ["cta_position"]=&gt;
        string(4) "Left"
        ["cta_title"]=&gt;
        string(11) "Contact now"
        ["cta_description"]=&gt;
        string(29) "know more about us to contact"
        ["cta_button"]=&gt;
        array(3) {
          ["title"]=&gt;
          string(20) "Test stepping stones"
          ["url"]=&gt;
          string(69) "/approach/steppingstones/test-stepping-stones/"
          ["target"]=&gt;
          string(0) ""
        }
      }
    }
    <pre></pre>
                    */
                if (have_rows('main_content')) :
                    while (have_rows('main_content')) : the_row();
    
                        echo "yo";
    
                    endwhile;
                else :
                // no layouts found
                endif;
                ?>
    
            </div>
        </div>
    <?php
    }

本文标签: ACFnot able to loop through flexible content field which is inside a group field