I would like to have dynamic commas in a list of authors, so for example if there is only one author of an article it would show: AUTHOR.

However if there was two or more authors, I would like to show a comma or an and bewteen each name like: AUTHOR ONE and AUTHOR TWO. Or in the example four authors: AUTHOR ONE, AUTHOR TWO, AUTHOR THREE and AUTHOR FOUR.

Note the 'and' and ',' in each example.

The code I'm using pulls out the correct data, but I need to put in dynamic commas depending how many authors each article has.


<h6 class="entry-meta">by {pp_author_one} {if pp_author_two != ""}, {pp_author_two}{/if} {if pp_author_three != ""}, {pp_author_three}{/if} {if pp_author_four != ""}and {pp_author_four}{/if} | <time datetime="{entry_date format="%Y-%m-%dT%H:%i"}" pubdate>{date_heading}{entry_date format="%d %F %Y"}{/date_heading}</time></h6><hr>
  • Mmm, that is bit tricky. I am not giving you a solution but pointing you a direction. github.com/danott/ee-loopee – Dimitri Kouvdis Feb 7 '14 at 15:25
  • 1
    can you please mention that how you are pulling the authors. It would be easy for someone to answer. – Bhashkar Yadav Feb 7 '14 at 15:25
  • 2
    What type of field are the authors stored in? – Jeremy Gimbel Feb 7 '14 at 15:41
  • @DimitriKouvdis Thanks. I have now installed this and will play. :) – Graham CopeKoga Feb 7 '14 at 15:44
  • @JeremyGimbel The field type is Text Input from a single entry channel. There are four Text Input fields, one for each author. – Graham CopeKoga Feb 7 '14 at 15:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.