Just to be clear this doesn’t necessarily given me those three interacting fields, but addresses the core requirement which is to normalise the data, provide a means to lookup data in a de facto table, and manage through wordpress the content in that de facto table.
Had some more thoughts about this.
I’m trying to find a way I can do this which avoids a custom table, but which lets my client manage the table of data.
I realised that I can use the repeater field to capture the data and then query it in a template that spits out JSON. My templates can then query that JSON. So that’s awesome.
What would make this great however would be a select field that can be automatically populated with the unique key of the repeater field data, say Suburb.
That then creates the link between the lookup table (my repeater field) and the place where that lookup table is needed (say a page template for listing office locations for example).
The concept of a select field being able to be populated by an external source seems to have fairly broad application too.
What do you think?
Yep that’s what I thought. Hence my feature request to change this.
just to be clear, this is what I currently see in the UI of my WP where my functions.php has the register field groups code. E.g nothing.
(The fields appear on the relevant posts and pages so I’m assuming this is correct behaviour)? If not, then my request I can see makes absolutely no sense!
Hi @elliot. sure thing.
At the moment, if acffields are registered with PHP (as opposed to manually creating them), there is no way (as I understand) to see those fields in the WP admin.
It would be good to see this. So a simplified version of your admin screen (e.g https://spruce.it/wordpress/media/2012/05/Edit-Field-Group-%E2%80%B9-Eyal-Press-%E2%80%94-WordPress.png).
You wouldn’t need to be able to edit the fields through the ui, just see what has been registered and what each field’s settings are (including its unique id).
This seems to be a useful debug tool – for confirming all the fields are being registered in WP correctly, and a nice way to check if a field’s settings are as expected (a visual representation is easier to read than the code).
It should still be possible to hide the UI completely for those who want to do that, but for me, having the benefits of registering fields with PHP AND the benefits of a visual representation in the UI would be the best of both worlds.
just throwing that out there.
ta
Charlie
Thank @elliot.
Javascript errors; the good news is there is a js error that gives us something to go by. see attached.
The bad news is I’m afraid I’ve wasted your time. I had a echo “hello” for debugging purposes just before the register fields code and that seems to be the culprit. Taking that line out fixes the issue!
apologies
thanks anyway
great. That key seems fine to me @elliot
It would be nice if we could specify a specific field in the filter function the way you can for other fields – e.g acf/fields/taxonomy/wp_list_categories/name=XYZ but not sure if that’s possible?
thanks
hi @elliot
I’ve just recently implemented your suggestion. Yet, as @socki03 has correctly indicated, field['name']
does not yield the correct result. If I recall correctly it actually returns the whole object array.
His suggestion of using strpos didn’t seem quite right to me (no disrespect) so I’ve done this.
if ($field['key'] == 'field_524561acf76e5')
This seems kosher (I hope) but hard-coding the field key seems to not be ideal. If I had to recreate that field (on another server for example) I’d have to update the key I imagine.
Is there a way a specific field can be targeted using the field name?
sure. It might be worth adding it to the field types list (http://www.advancedcustomfields.com/resources/#field-types)?
Thanks @elliot
thanks @elliot. the code above makes sense. I must say I’m confused about the taxonomy field. The documentation page (http://www.advancedcustomfields.com/resources/) doesn’t say anything about a built in taxonomy field AFAIK.
I haven’t installed the add-on so I presume I’m using the built in one. Are they more or less the same?
Great. I got it working too.
Is there a way this can be applied only to 1 specific taxonomy field? I have a filter that’s useful for one taxonomy field but not something I’d want to apply to all my taxonomy fields.
I tried in my add_filter function using ‘acf/fields/taxonomy/wp_list_categories/name=XYZ’ but that didn’t work (the field just displayed all the categories)
Alternatively I just might not be understanding this correctly.
Thanks
filter the list of pages that users can select from by parent – this was exactly the feature I was going to request too!
I understand @elliot you’ve indicated how this could be done, but a way to do this through the UI would be lovely.
Hi @elliot
I thought that’s what you meant. But I couldn’t find the radio button on your site so I wasn’t sure.
Thanks!
hi @elliot. Great, thanks. Although – Sorry – not sure what you mean by the radio field?
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.