Support

Account

Home Forums General Issues How would you handle this? A legion of regions.

Solved

How would you handle this? A legion of regions.

  • Hi folks, how would you handle this weird request?

    I want to create fields for a bunch of locations that have a few fields in common.

    Kind of like this:

    
    Region 1
      [] Name
      [] Event Date
      [] Featured?
      [] Link
    Region 2
      [] Name
      [] Event Date
      [] Featured?
      [] Link
    Region 3
      [] Name
      [] Event Date
      [] Featured?
      [] Link
    ...
    Region 60
      [] Name
      [] Event Date
      [] Featured?
      [] Link
    

    Now you might think that a repeater field is the way to go, and you might be right.

    However, but there are a few special requirements:

    1. Every region has a unique name that may not repeat.
    2. On pages where we use these fields, all 60 regions must appear.
    3. I’d like to make this easy for website editors to use if at all possible. 🙂

    What would you do?

    I’m fairly familiar with using ACF, but I keep coming up with clumsy solutions to this problem.

    So I’m wondering:

    Because you are almost certainly smarter than me, do you have a recommended solution for this?

    Thank you for any advice!

  • Given the information you provided, I would look at using a custom post type and not a repeater.

  • Thanks, John. I hadn’t thought of that.

    What do you think the advantages would be if we loop through posts of a custom post type, rather then looping through repeater fields?

  • Having 60 rows in a repeater will likely be an issue unless you increase php max_input_vars.

    Using a CPT will allow for and unknown future enhancement. If you use a repeater it will be more difficult to make changes.

    Repeaters are difficult to search/filter and they are difficult to put in some order other than the order they are entered. Repeaters have their place, I just don’t feel that it for large data sets.

  • Thank you, John. I appreciate your advice.

    You made excellent points here.

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

You must be logged in to reply to this topic.