- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
export to template context question
SOLVE10-10-2018 02:32
I have two blogs:
Default: Posts
Team Members: Member bios and contact information
On each bio (in Team blog) , I'm trying to display the 3 most recent posts by each member (found in Default blog.)
When I use the following code in the team blog post template, it works. I get the 3 recent results from john-doe.
{% set author_posts = blog_recent_author_posts('default', 'john-doe', 3) %} {% for author_post in author_posts %} <div class="post-title">{{ author_post.name }}</div> {% endfor %}
However, I need this to be team-member-specific.
So, to the Team Member blog page, I added a field to enter the author slug:
{% text "authslug" label="Author Slug", export_to_template_context=True %}
And I am able to output that value in my template with:
{{ content.widgets.authslug.body.value }}
EXCEPT, for when I try to put that code into the call for the 3 posts:
{% set author_posts = blog_recent_author_posts('default', '{{ content.widgets.authslug.body.value }}', 3) %} {% for author_post in author_posts %} <div class="post-title">{{ author_post.name }}</div> {% endfor %}
Any ideas on how to get the team member's author slug(from default blog) to output in the code above?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content