Recently when working on a client's website I needed to use the ACF repeater fields on a WordPress site that was built on Divi. After doing a quick google search and reading a few articles it seemed normal ACF fields on Divi's modules work flawlessly but when it comes to the repeater fields there seem to be technical issues and after a search on ACF support, it looks like I was not the only one with the same problem.

So I've created a custom page template for the custom post type because how else am I going to get the repeater fields showing up on the page, I completed the page and nonetheless the client ends up asking for the content to be put into tabs. I initially thought of adding bootstrap for it's tabbed featured and quickly remembered and realized that it may conflict with Divi and that Divi had its own built-in tab module.

Inserting Divi Modules into the templates

Instead of rebuilding the own page on a Divi, I decided to use the page template but somehow integrate the Divi tab module into my page template. So after a quick google search, I ended up on a post about how to integrate Divi section into a page template, so after skimming through the article I ended finding the piece of code I needed;

<?php echo do_shortcode('[et_pb_section global_module="198"][/et_pb_section]'); ?>

Using the Divi library you can create a section with any module and using the shortcode above you can insert into any page template you'll need the module on.

With that, I created the tab module with a few test tabs and sure enough the module loaded onto the page where I had inserted the line of code, now to get the ACF repeater field working on the module.

In comes ACF Repeater

I know I needed PHP for the ACF repeater fields to work properly so from my older work I've learned using shortcodes to run code is a neat little trick and works almost everywhere in WordPress and could get anything done and it's in the functions.php file so it can run PHP!

Using the WordPress shortcode API and ob_start(); I've created a simple solution to the problem with displaying ACF repeater fields in Divi modules.

Just place inside your functions.php file and add your ACF repeater fields coding inside, then add the shortcode (in this case [foobar]) to the Divi module

function foobar_func( $atts ){
ob_start();
//ACF fields here
return ob_get_clean();
}
add_shortcode( 'foobar', 'foobar_func' );

Let me know in the comments before if it works for you or if you have another way to add the ACF repeater fields to the Divi modules

Work Experience
Andar Software Ltd.
Front-End Web Developer
08 / 2022 - Present
08 / 2015 - 06 / 2019
9345-1961 Quebec Inc.
Wordpress Developer
09 / 2021 - 08 / 2022
Yellow Pages
Front-End Developer
06 / 2019 - 11 / 2020
perpetual media ltd.
Developer
2011 - 2022
iPosco Systems Inc.
Web & Graphic Designer
12 / 2011
Technology Stack
Adobe Creative Cloud
HTML 5
CSS 3
JS / jQuery
PHP
mySQL / msSQL
Wordpress / WooCommerce
Shopify
Bootstrap
React
Solidity
web3.js
Laravel
Tailwind
AplineJS
Livewire
© 2024 PERPETUAL MEDIA LTD
rickypoon.ca
linkedin facebook pinterest youtube rss twitter instagram facebook-blank rss-blank linkedin-blank pinterest youtube twitter instagram