8

I have a blog. I want to output an entry author's first and last name. What is a good method to accomplish this?

  • Is "author" a reserved term in Craft CMS? I made a field called "author" but it is returning my name (I'm the one who typed the entries in) instead of the author of the article I'm entering. – David Rhoden Jul 9 '17 at 7:19
18

For each entry, you can get the username of the author by simply using {{ entry.author }} (assuming entry is the variable containing the blog entry).

If you want to display Full name, first name and/or last name for one entry, you'd use:

{{ entry.author.fullName }}
{{ entry.author.firstName }}
{{ entry.author.lastName }}

For a list of entries and their authors, you'd use:

{% for entry in craft.entries.section('your-section').find() %}
    {{ entry.author.fullName }}
{% endfor %}
3
{{ entry.author.firstName }} {{ entry.author.lastName }}

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.