How to list entries by author (with member fields) in Expression Engine
Here is a real simple way to list entries by author and displaying their profile info, while getting around Expression Engine's parsing order.
On one of my websites I needed a simple way to display a random list of entries, by author (from my long list authors), as well as that author's member profile information. Unfortunately, there is no default way of doing this using your standard weblog:entries tag pair. So, I had to do a little EE trickery while using EE's parsing order as my pawn.
Here is a simple way to list entries by author using your standard weblog entries tag.
First, wrap your markup with your standard weblog:entries tags. Here, I wanted to display some specific authors (by their member/author ID) randomly from my weblog called, "Network".
{exp:weblog:entries weblog="network" limit="1" author_id="1|2|3" orderby="random" dynamic="off"}{author}
URL: {url}
{custom_profile_field}
- {title}
Next, create a new template with markup to pull the author entries; I called mine, "member_entry_shortlist". This template will be your embedded template. In this case, I using an unordered list, so I decided that my template will just have a list item.
{exp:weblog:entries weblog="network" limit="5" dynamic="off" author_id="{embed:network_author}"}
Notice here what the embed variable is, "embed:author". I'll show you how this is passed in the next step.
Next, to get around EE's parsing order, using an embed, I am going to pull the actual entries in to my unordered list. You'll see that I created an extra variable in my embed called, "network_author" with a value of the {author_id} from the displayed author.
...
-
{embed="network/member_entry_shortlist" network_author="{author_id}"}
And there you have it. The full markup could be something like this:
Featured Author's Post
{exp:weblog:entries weblog="network" limit="1" author_id="1|2|3" orderby="random" dynamic="off"}{author}
URL: {url}
{custom_profile_field}
-
{embed="network/member_entry_shortlist" network_author="{author_id}"}
Filed in: Expression Engine | Posted on: September 06, 2009 | (2) Comments → Add yours
diseno de volantes
October 01, 2009
Muy buen blog! great blog! thanks from Argentina.
TMJ Exercises
August 26, 2010
I was very pleased to find this site.I wanted to thank you for this great read!! I definitely enjoying every little bit of it and I have you bookmarked to check out new stuff you post.
Add a comment
But please keep you comments clean and on topic. And yes, you can use basic HTML.
Commenting is not available in this weblog entry.