How do I print the number of entries assigned to a category? Okay, all I want to do is list all categories AND the # of entries associated with each category.

{% set numofEntries = craft.entries.section('posts').relatedTo(category).total() %}

&lt;p class="tags"&gt;
    {% for categoryName in craft.categories.group('markets') %}
        &lt;a href="{{ categoryName.url }}"&gt;{{ categoryName.title }}-{{numofEntries}}&lt;/a&gt;
    {% endfor %}
&lt;/p&gt; 


No error is thrown (and I am in dev mode), but the number that appears (49) is the same for all categories (and doesn't even equal the number of total entries).  

A few things...  


market group = markets ...
the category field handler = marketName
You'll want to query for the number of entries inside the for loop.

{% for categoryName in craft.categories.group('markets') %}
    {% set numofEntries = craft.entries.section('posts').relatedTo(categoryName).total() %}

    &lt;a href="{{ categoryName.url }}"&gt;{{ categoryName.title }}-{{numofEntries}}&lt;/a&gt;
{% endfor %}