Adding custom fields to Tainacan taxonomy

hi, I want to add additional fields to Tainacan taxonomies (in our case, a wikidata link). I tried with Advanced Custom Fields but the new field does not show up in Tainacan. Do you think that’s the best way to do it (with ACF support added to Tainacan to look for added custom fields) or do you have other suggestions?

Hello again @AronAmbrosiani! I think you and @daltonmartins should definitely have a chat one day, we have some plans for Wikidata integration for the future!

That said, it is not that easy right now. We really don’t have any integration of the Tainacan forms with ACF. I do have a feeling that if you:

  1. Go to the Taxonomy settings inside the Tainacan Admin;
  2. Enable the Taxonomy for any of the WP post types, (for example, the posts);
  3. Go the WP admin and access that post type categories screen;
  4. Edit the taxonomy there…

You should have access to the ACF fields. The fact that you are enabling them for other post types, though, will cause a side effect… the Term link won’t go the traditional Tainacan Term Items list, but to the WordPress default post per term screen.

Let me know if that works, it is really a guess. Otherwise, we can investigate other solutions.

1 Like

Hey @AronAmbrosiani, I actually just remembered that we have another way, but it is a bit experimental and certainly need documentation… might be a good opportunity to test it :slight_smile:

We have a “hidden feature”, available for developers, which are Form Hooks. They exist in the Collection, Item, Metadata, Filter, Taxonomy and Terms forms. You can call an action tainacan-register-admin-hooks to hook inside one of the forms and add an extra field to this form. Unfortunately, all we can give you is some code examples by now to show you situations where we did it:

Here is the Tainacan Interface theme, adding a color picker inside the Collection form, to set a tainacan_background_color and a tainacan_text_color value in the collection:

Her is another theme, adding a expanded_filter variable as a “yes/no” option to the Metadata form:

And that same other theme, adding a taxonomy to the Collection Form:

Your code should be actually simpler as you only need a text input. There are other things going on in these examples. If this doesn’t help you enough or if it really doesn’t work at all, let me know. There are two hooks in the Tainacan Taxonomy form: ['taxonomy']['begin-left'] and ['taxonomy']['end-left']'. You may also want to check that form’s source code to get a glimpse of what is going on:

1 Like

very interesting – I’ll try both methods and report back :slight_smile:

1 Like

@mateus.m.luna using the first method (exposing the taxonomy to the rest of wordpress) worked fine – result is here: Kristina av Sverige – Monument

I’ll try the other method as well in my learning process :slight_smile:

1 Like

Hi @AronAmbrosiani and @mateus.m.luna. In fact, we are working in an initial research about roundtripping involving Tainacan and Wikidata/Commons. I saw, @AronAmbrosiani , that you participated in this initiative ( I had some conversations with Sandra Fauconnier about roundtripping too. I wrote a small executive summary about our ideas and if you are interested in this conversation it will be a pleasure to talk about. Some details here: Executive summary - Tainacan and Open Refine - Google Docs