Multiple terms ACF

Hello,
I’m trying to create a field with ACF for multiple terms. The terms in this situation are actually the authors of the articles on my site. It is a website based on contributors and there are a lot of authors so I don’t want to create a wordpress user for every single author. I would prefer to use a taxonomy field and then display multiple authors where there is such a case. I’ve managed to assign, display and also create an URL for posts that have a single author (site.com/author-1/{{dc:term:slug}}). But I’m struggling finding a solution for posts that have two or more. I thought of 2 approaches:

  1. I’ve noticed that the taxonomy field accepts multiple inputs but I can’t find a way of displaying them or creating an URL for each term.
  2. I’ve figured that I can create two taxonomy fields “author 1” and “author 2”. The div that contains the latter is displayed only if a certain condition is met. My problem here is creating the URL that would display all the articles written by lets say the term Robert Smith that is assigned to both “author 1” and “author 2” .

Hope I was clear enough.
Can you help me out please?

Hello @robertblaj,

Thank you for the inquiry.

Have you tried creating a Looper Provider > Dynamic Content with the ACF taxonomy field as the value?

https://theme.co/docs/loopers
https://theme.co/docs/acf-pro-and-loopers

You should be able to retrieve the terms this way. You could also use a Twig template.

https://theme.co/docs/twig

Please provide the login details in the secure note so that we can check the site.

Best regards.

No I haven’t tried twig yet. I’m gonna have a look at it now. I posted the login details above.

Thank you for the info. Could you provide direct links to the posts with multiple authors? We couldn’t find one in the list.

The first post on the page below has multiple authors. Now it seems that the authors are being displayed and the urls are ok, but I can’t manage to put them in one line with a “&” between them.

Thank you for the info.

We enabled Flexbox for the autoare element, then adjusted the Twig template in the Text element.

Let us know if you need more info.

Best regards.

Wow, thank you so much!
It’s almost perfect! Now the only problem is that the “&” element appears after every author, even if the post has a single author.

Best

Hey @robertblaj,

I’ve updated the code so that the “&” will only show if multiple authors exist.

Hope that helps.

It’s perfect now. Thank you! I couldn’t find any reference in twig’s docs about “looper.index_number”. Could you please tell me where can I read more about it? Also I can’t figure out by myself why is this line first {% if looper.index_number > 1 %} &amp; {%endif%} and this one second <a href="/autoarx/{{dc:term:slug}}">{{term.name }} </a>

One more thing. On the single page I have the authors biographies. It would be useful if I could output the names of the authors separately like “term number 1” and “term number 2” in order to use them as headlines before the biography. How can I do that?

Later edit: I found a way {% if looper.index_number == 1 %}{{dc:term:name}}&nbsp; {% endif %}
If there’s a more fancier way please share
Thank you!

Best

Hello @robertblaj,

I checked your single post layout it seems that you have already displayed the author name and term name separately.

Thanks