Home › Forums › Add-ons › Repeater Field › Repeater populating dropdown on post edit page
Hi.
I’m looking to create a Repeater-field in my Options-page. The repeater shall then populate into a Drop-down visible on the “Edit”-Page of a post. I’d like to use it to be able to create items of contact information for the management team on the options page, and have them selectable on posts/pages.
Is this possible?
Hi @Patrik
This sounds like a good fit for a tutorial I wrote here:
http://www.advancedcustomfields.com/resources/tutorials/dynamically-populate-a-select-fields-choices/
This covers how to dynamically populate a select field based on an options page repeater!
Hope that helps.
Thanks
E
This seems to do exactly what I need!
However I’ve done what the tutorial says (Example 2,) but it’s not working.
Is the tutorial meant for populating a drop-down on an “Edit post page”, or made for use on the front-end?
Edit:
Does the tutorial require that I include ACF in my theme, or can it remain a as a plugin?
Hi @Patrik
This does not require ACF to be added in your theme
The tutorial shows how to modify a field object. If you load this field on the front end, then the above code will run.
Thanks
E
Ah I see. That’s the problem then – I load the field within the Admin, so the code doesn’t execute… Is that possible to do?
Hi @Patrik
I don’t quite understand what you mean by the above, and I don’t know how to answer your question. Can you please re phrase?
Thanks
E
Ok so, this is what I want to do:
I want to have a drop-down (<select>
) on the Posts > Add Post / Edit Post page. I want this drop-down to be populated by a <i>Repeater</i> on the Options page.
Essentially, I can then go to the Options page only visible to me, and using the repeater I can add Contact Persons for example.
Then, as a regular user adds a post (a press release for instance,) he/she can choose which of the Contact Persons I’ve added, to be visible on the press release itself.
Then I must have done something wrong, because I couldn’t get it to work :/
I’ll try again and I’ll let you know.
The topic ‘Repeater populating dropdown on post edit page’ is closed to new replies.
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.