Created
May 13, 2010 00:20
-
-
Save aaronmcadam/399315 to your computer and use it in GitHub Desktop.
Expression Engine Number of posts under Categories
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{!-- | |
This script is useful for grabbing the number of entries under a category | |
--} | |
{exp:weblog:categories weblog="faq" style="nested" show_empty="yes"} | |
<h2>{category_name}</h2> | |
{exp:query sql="SELECT count(exp_category_posts.entry_id) AS post_count FROM exp_category_posts WHERE exp_category_posts.cat_id = {category_id}"} | |
<h4>{post_count} Question(s)</h4> | |
{/exp:query} | |
{exp:weblog:entries weblog="faq" disable="member_data|trackbacks" paginate="top" category="{category_id}"} | |
<h3><span class="question">Q.</span> {title}</h3> | |
<a href="#" title="Show Answer" class="show">Show Answer</a> | |
<div class="answer">{faq_answer}</div> | |
{/exp:weblog:entries} | |
{/exp:weblog:categories} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This script is useful for grabbing the number of entries under a category