Support

Account

Home Forums General Issues Help with Default Values Updating

Solving

Help with Default Values Updating

  • Hi,
    I’m new to ACF and think it’s great! I believe my use case might not be unusual; however I’m having trouble finding a solution in the docs.

    We are needing to set some site-wide custom field values to utilize within the text of our pages, but also need the ability to change them and for them to dynamically update the default values on each page, and that doesn’t seem to be happening.

    Specifically, we are using shortcode to display the text like this for example:

    [acf field="specialty"], [acf field="name"], is conveniently located at [acf field="address"] and serves [acf field="area"] and [acf field="area_large"]

    using these fields
    Specialty (default):
    Women’s health specialist

    Name:
    Cindy Lewis of Austin Wellness

    Address:
    123 Lamar Avenue

    Area:
    Austin

    Area Large:
    the greater Travis County metro areas.

    On page reads:
    Womens’s health specialist, Cindy Lewis of Austin Wellness, is conveniently located at 123 Lamar Avenue and serves Austin and the greater Travis County metro areas.

    There are other ways we use this and it’s really helpful, until we need to make a change, and we have dozens and dozens of pages that don’t change because the default values don’t seem to be dynamically changing.

    We use ACF Pro with the Avada theme, but we’re bypassing their dynamic content element because it only allows for one item per block, whereas using your shortcode gives us the ability to write sentences like the one above.

    In any case, I set these up as Text fields, but is there a different field type that would make the default values dynamically update? Or is there something we can do to “lock” the default values?

    Please advise! thank you!

  • You wouldn’t likely be using default values at all within ACF for this use case, unless I’m misunderstanding what you’re doing. Default values on fields are used to have something be populated automatically/by default when creating a new item. So changing the “default value” in of a field type won’t actually change any field value on an item, it would just use that moving forward when creating future new posts.

  • I don’t know if you can to this in Avada. The way to do this normally, or how I would do it if I was building a site, would be to have these fields be optional (not required) on posts and then in addition to these fields there would be an acf options page to hold default values. In the template I would see if the post has any values and if not then I would show the values from the options page.

    This could be done using an acf/format_value filter in your functions.php file. Your filter would check to see if the field has a value and if it does not then it would return the value from the options page.

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

You must be logged in to reply to this topic.