Question:
I want a page that lists off the Category Name and then has custom fields from every post in that category listed before moving to the next Category Name and repeating the process. How can I accomplish this?
Answer:
It’s doable under 1.1 using nested function calls, but it could be VERY load intensive if you have a lot of entries. Here’s one way you could do it:
Method 1:
Les suggested this:
{exp:weblog:category_archive weblog="weblog1"}
{categories}
<h3>{category_name}</h3>
{if category_description}
<p>{category_description}</p>
{/if}
{exp:weblog:entries weblog="weblog1" orderby="date"
category="{category_id}" sort="asc" limit="50" }
Entry Title: <a href="{title_permalink="weblog/comments"}">{title}</a>
- {comment_total} Comments<br />
<p>{body}</p>
{paginate}
<div class="paginate">
<span class="pagecount">Page {current_page} of {total_pages} pages</span>
{pagination_links}
</div>
{/paginate}
{/exp:weblog:entries}
{/categories}
{/exp:weblog:category_archive}
It is highly recommend making use of the paginate function in some fashion similar to what I show here if you have a lot of entires. In testing on a site with 2,000+ entries it took close to a minute to render the above and it was still loading the page when the browser window was closed.
Method 2
Another method is suggested further down in the relevant topic, by wsmith:
<table border="1">
{exp:weblog:categories weblog="weblog1" style="linear"}
<tr>
<td>
<h3>{category_name}</h3>
{if category_description}
<p>{category_description}</p>
{/if}
</td>
<td>
<b>Stories</b><br />
{exp:weblog:entries weblog="discussion" category="{category_id}" }
{title}<br />
{summary}
<a href="Discussion">Discussion</a>
{/exp:weblog:entries}<br />
<br />
</td>
</tr>
{/exp:weblog:categories}
</table>
Question:
I want the Category Archive function to only list a limited number of latest entries per category rather than all entries per category?
Answer:
Here is how to list only 5 entries per category:
{exp:weblog:category_archive weblog="{weblog_name}"}
{categories}
{category_name}
{exp:weblog:entries weblog="{weblog_name}" orderby="date" category="{category_id}" sort="asc" limit="5" }
<a href="{title_permalink="weblog/comments"}">{title}</a>
- {comment_total} Comments<br />
{/exp:weblog:entries}
{/categories}
{/exp:weblog:category_archive}
Category:Categories Category:Tricks
