Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using repeater field with default wordpress and theme #157

Open
EmWe5 opened this issue Jul 29, 2022 · 0 comments
Open

Using repeater field with default wordpress and theme #157

EmWe5 opened this issue Jul 29, 2022 · 0 comments

Comments

@EmWe5
Copy link

EmWe5 commented Jul 29, 2022

I'm experiencing problems to make acf-builder work on a standard wordpress setup. I'm using:

  • default wordpress (no bedrock)
  • default theme like twentytwenty

My approach:

In the theme folder I created a composer.json file with acf-builder inside and ran composer install.
In the functions.php I required the autoload file. (require_once('vendor/stoutlogic/acf-builder/autoload.php');)
I know that acf-builder is relying on the 3rd party library that has also been installed successfully.
To avoid 500 erros I specified "button_label" on my repeater field.

The problem

There is no error but in the backend there is no button showing up on the repeater field. I mean the button like "Add whatever".
Same behaviour on Flexible Content element.

There are no errors in the browser console.
The fields like the text field are working normally.

Here is my code of functions.php

require_once('vendor/stoutlogic/acf-builder/autoload.php');

$banner = new StoutLogic\AcfBuilder\FieldsBuilder('banner');
$banner
    ->addText('title')
    ->addRepeater('columns', [
        'button_label' => 'Add new element'
    ])
    ->addText('column_headline')
    ->endRepeater()
    ->addText('other_text');

$banner->setLocation('post_type', '==', 'page');

add_action('acf/init', function() use ($banner) {
    acf_add_local_field_group($banner->build());
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant