I have a blog. I want to output an entry author's first and last name. What is a good method to accomplish this?
Asked
Active
Viewed 4,756 times
8
-
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 09 '17 at 07:19
2 Answers
22
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 %}
Paul
- 6,338
- 12
- 26
3
{{ entry.author.firstName }} {{ entry.author.lastName }}
Jamie Wade
- 3,644
- 2
- 16
- 32
blairrorani
- 413
- 3
- 11