Hi,
I’m trying to display entries by author. I’ve an issue because my template uses Masonry to generate entries and I need to display the author name outside {exp:channel:entries}, I need to get the name at the top of the page.
This is the code i use to generate entries with Masonry:
<div>NEED AUTHOR NAME HERE</div>
<div id="container-din">
{exp:channel:entries channel="test" dynamic="no" order by="random" status="not closed|pending review" paginate="top" limit="12" author_id="{segment_3}"}
<div class="item2">{product_images}
<figure>
<a href="http://p/{url_title}" title="{title}">_ {product_images:product_category_resized}</a>{/product_images}
</figure>
<span class="photo-title"><span 400; font-size: 14px;">{avatar_url}
{screen_name} in {categories limit="1" show="not 1|2|3|4|5"}<a href="http://{path=channel/index}">{category_name}</a>{/categories}</span></span>
</div>{paginate}
<span>Page {current_page} of {total_pages} pages {pagination_links}</span>
{/paginate}{/exp:channel:entries}
</div>As entries are masonry generated, if I put the {exp:channel:entries channel="photos" dynamic="no" order by="random" status="not closed|pending review" paginate="top" limit="12" author_id="{segment_3}”} above <div>NEED AUTHOR NAME HERE</div> author name will be displayed 12 times.
I think I’m doing anything wrong…
Thank you for your help.
It doesn’t have to be outside the tag, just make sure that the author name is only displayed with the first entry returned. Here’s how:
<div id="container-din">
{exp:channel:entries channel="test" dynamic="no" order by="random" status="not closed|pending review" paginate="top" limit="12" author_id="{segment_3}"}
{if count == 1}<div>{author}</div>{/if}
<div class="item2">{product_images}
<figure>
<a href="http://p/{url_title}" title="{title}">_ {product_images:product_category_resized}</a>{/product_images}
</figure>
<span class="photo-title"><span 400; font-size: 14px;">{avatar_url}
{screen_name} in {categories limit="1" show="not 1|2|3|4|5"}<a href="http://{path=channel/index}">{category_name}</a>{/categories}</span></span>
</div>{paginate}
<span>Page {current_page} of {total_pages} pages {pagination_links}</span>
{/paginate}{/exp:channel:entries}
</div>Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.