4

is there a simple out of the box approach to showing entries created by their author? EG: after an article I want to list a credit like so:

"article by AUTHOR"

and allow a click through from the AUTHOR link to a template featuring just that author's entries…

Thanks.

2 Answers 2

11

You can include the author's name and a link using the author and author_id variables. For example:

{exp:channel:entries channel="blog"}
    <h2>{title}</h2>
    {body}
    <p>Posted by <a href="/blog/author/{author_id}">{author}</a></p>
{/exp:channel:entries}

Then, at its most basic, create a template to display posts filtered by author (the template used in the example above is blog.group/author.html). In that template, filter the Channel entries with the author_id parameter.

{exp:channel:entries channel="blog" author_id="{segment_3}"}
    {if count == "1"}
        <h1>All Posts by {author}</h1>
        <ul>
    {/if}

    <li>{title}</li>

    {if count == total_results}
        </ul>
    {/if}
{/exp:channel:entries}
2
  • Thanks! I didn't want to use a possible 'Zoo Visitor' or 'Playa' approach for just this functionality. This is great.
    – user2569
    Jan 9, 2014 at 9:10
  • 1
    You're welcome! On Stack Exchange you can accept an answer by ticking the checkmark on the left. This is optional, but generally encouraged if an answer provided you with a solution. See expressionengine.stackexchange.com/help/accepted-answer
    – Alex Kendrick
    Jan 9, 2014 at 14:47
0

BTW at least with EE2 it's important to include the parameter dynamic="off" to make this work. Example:

{exp:channel:entries channel="features" author_id="{segment_3}" dynamic="off" }

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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