Support

Account

Home Forums Add-ons Flexible Content Field Do FCF's allow this level of modularity? Reply To: Do FCF's allow this level of modularity?

  • It works just fine, though “sharing the modules” is pain since all flexible layout “modules” (I call them blocks) are not easily thrown to different Custom Field group.

    Thus I have single Custom Field Group with one field, the Flexible Layout Field with all of my blocks.

    I use these theme files:

    Layout.php

    <?php
    if (have_rows('layout_blocks')) {
        while (have_rows('layout_blocks')) {
            the_row();
            echo get_template_part("block", get_row_layout());
        }
    }?>

    include the layout.php on each page I need to, and then I simply have for each module or a block an own PHP file like:

    block-header-left.php

    <section class="header-left page-wrapper">
        <div class="container">
        	<h1><?php the_sub_field('title'); ?></h1>
        	<div class="content"><?php the_sub_field('content'); ?></div>
        	<div class="clear"></div>
        </div>
    </section>

    Fetch data etc on each block as you would normally in PHP files.