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.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We’re reaching out to our multilingual users to ask for help in translating ACF 6.1. Help make sure the latest features are available in your language here: https://t.co/TkEc2Exd6U
— Advanced Custom Fields (@wp_acf) May 22, 2023
© 2023 Advanced Custom Fields.
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.