Home › Forums › Add-ons › Repeater Field › Set Dynamic Placeholders for Sub Fields › Reply To: Set Dynamic Placeholders for Sub Fields
Hi @FATMedia
Sure. The easiest way to do this is to use the ACF filter called acf/load_value.
You will find docs for this on the documentation page. Use it to hook into any value loaded for the repeater field.
If the value is empty, this means that the post must be a new one, in this case, you can modify the value to trick ACF into rendering 3 rows of data.
All you need to do is set the value to this format:
$value = array(
array(
'field_123' = 'Placeholder Title',
'field_456' = 'Placeholder text here...'
),
array(
'field_123' = 'Another Placeholder Title',
'field_456' = 'Different Placeholder text here...'
),
array(
'field_123' = 'Yet Another Placeholder Title',
'field_456' = 'Another Different Placeholder text here...'
)
);
When editing the field group, you can toggle on ‘show field keys’ via the screen options menu tab. This will give you the sub field keys for field_123 and field_456.
Hope that helps.
Thanks
E
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 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 Privacy Policy. If you continue to use this site, you consent to our use of cookies.