Hi, I want to display how many posts are in a category.
Posts are categorised with relation to the template in blog_category.php.
In my code below achieve that, but I wonder if is there an easier way to do?
The final touch will be a looping through a blog_category.php and generate the li elements like this: https://www.couchcms.com/forum/viewtopic.php?f=2&t=9243&p=19512&hilit=my_events_template_link#p19512
Posts are categorised with relation to the template in blog_category.php.
In my code below achieve that, but I wonder if is there an easier way to do?
The final touch will be a looping through a blog_category.php and generate the li elements like this: https://www.couchcms.com/forum/viewtopic.php?f=2&t=9243&p=19512&hilit=my_events_template_link#p19512
- Code: Select all
<cms:set my_events_template_link_category="<cms:link 'blog-post.php' />" />
<div class="category-widget">
<ul>
<li><a href="<cms:add_querystring my_events_template_link " category=web-design" />" class="cat-1">Web Design<span><cms:pages masterpage="blog-post.php" custom_field="blog_category=web-design"><cms:set web_design_count="<cms:show k_total_records />" "global" /></cms:pages><cms:show web_design_count /></span></a></li>
<li><a href="#" class="cat-2">JavaScript<span>74</span></a></li>
<li><a href="#" class="cat-4">JQuery<span>41</span></a></li>
<li><a href="#" class="cat-3">CSS<span>35</span></a></li>
</ul>
</div>