Support

Account

Home Forums Add-ons Options Page Adding Repeater Field Values to a Post

Solving

Adding Repeater Field Values to a Post

  • I want to be able to assign a featured add to some blog posts… I was thinking I could create a repeater field (featured_ads) for the options page where I could add as many ads as needed that can be used on the site. Each ad would have the following subfields (ad_headline, ad_image, and ad_url). If I did this how could I make the repeater field values selectable from a specific post. Also, I would like the option to bot select an ad at all on some posts.

    Any ideas?

  • You would need to create a select field and dynamically populate the values of the select field from the values in the repeater.

    You will also need to add a unique identifier field to every row of the repeater so that if anything else in the row is changed this value can still be used to locate it. https://www.google.com/search?q=acf+repeater+unique+id
    You will use this unique field to loop over the repeater an locate the one to show.

    This is not the best way to accomplish what you want to do. The best way would be to create a custom post type to hold your Ads and then use a post object field to select them.

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.