Display author of current post on single template

I’m not sure if your markup is inside a loop or not, but if it’s not and you’ve got it displaying on a single post page, then L&L would just be taking the fields from the current posts, just as if it was in a post loop That means that in your case, Field url would refer to the URL of the current post, not the post archive URL.

Your intuition was totally correct that you’d need to be working with a User loop so that you can reference user-specific fields like the user’s post archive URL (which is Field archive_url). If you’re curious why you’d need to create a loop to give L&L some context about where to look for the post archive URL data, you can check out this comment I made for someone with a similar question.

So if I understand correctly, you’d need to create a user loop that only loops through the user that wrote the current post (whatever post your L&L markup gets placed on). You could pass the author field from the current post to the id parameter of a user loop. Sorry if that sounds like word salad! In practice it’s pretty simple and would look something like this:

<Loop type=user id="{Field author}">
  <a href="{Field archive_url}"><Field full_name /></a>
</Loop>

Hope that helps!

1 Like