Support

Account

Home Forums General Issues Load pre-defined values for fields?

Solving

Load pre-defined values for fields?

  • I have an options page where the customer can choose colors for his layout:
    load presets

    Now i would like to add some kind of “load color preset” like shown in the image. Any idea how to do this?

  • You would create acf/load_field filters for each of the fields you want to preset the values for.

    http://www.advancedcustomfields.com/resources/acfload_field/

    The example shows how to set ‘choices’ but it can also be used to set any of the values of a field.

  • Hi @herrfischer

    Hmm.. I suppose you could do this by adding some custom JS to the page.

    Basically you’ll save some site meta information containing these default presets (in wp_options).. perhaps that’s something you should do on activation of the theme but I leave that up to you.

    Then, when a person clicks one preset button you run some javascript that does an ajax call and fetches the preset information (get_option()). Then you’ll simply input those values into the input fields within ACF using javascript..
    jQuery('#inputfield').val(ajaxresponse.farbeA);

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

The topic ‘Load pre-defined values for fields?’ is closed to new replies.