Support

Account

Home Forums Backend Issues (wp-admin) True / False Field Type Limit

Solved

True / False Field Type Limit

  • Hi, I am new to the forum but I am an avid fan of ACF.

    I just have a little request if this is possible.

    My request is about the true/false field type. Can you put an additional feature for this field type where in it has a limitation in a post. For example if I have a top 10 items then I will use this field and if there are already 10 items marked as the top 10, this field will not show anymore.

    Hope my request is clear.

    Thanks to the Dev Team!

  • Hi @dashawk

    Would you mind attaching an image demonstrating your idea visually? I’m having a hard time comprehending the question.

    Thanks
    E

  • Hi elliot,

    Thanks for the quick reply, I am uploading the image of what my idea is all about.

    Thanks

  • Hi @dashawk

    Thanks for the screenshot. I understand the question now.

    This is far to custom to include into the core im afraid. That said, it would be possible for you to write some custom code to do this for you.

    I would add a function to the wp_head action which would append some jquery to the page. You could query the DB for the amount of posts with this checkbox value (see docs for querying), then depending on the value, you could generate some jQuery to either remove / hide or disable the checkbox field.

    All up, it should only take 30 minutes or so.

    Good luck

    Thanks
    E

  • Hi @elliot,

    Thanks for the suggestion, but I don’t know where to put my queries. I checked on the core->field->true_false codes but I am not certain where to put the conditions.

    Could you help me out what files to edit or what folder should I go to? I haven’t tried creating a new field type for acf though.

    Thanks

  • Hi @dashawk

    You don’t need to create a custom field type (did I imply that? I did not mean to).
    All you need to do is add some custom script to the admin_head action.

    If you are not confident in doing this, I would advise you to contract a freelance developer to add the functionality into your site.

    Good luck

    Thanks
    E

  • Hi @elliot,

    As what you suggested earlier, I gathered up an idea tried to implement my queries in the true_false field and I got carried away that the true_false field is fully modified by me and will not be able to serve its purpose anymore. So I created a custom field type instead 😀 out of it.

    This is actually a good experience to me and a new learning for today. I succesfully created a “Top[N] Field Type” as what I called it 😀 and it works perfectly.

    Thank you for the advise @elliot, really appreciate it.

    Cheers!

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

The topic ‘True / False Field Type Limit’ is closed to new replies.