title: Wordpress - get the post count number of a taxonomy term and get the taxonomy term id in the loop
body: <p>I want to accomplish a nice portfolio listing by the help of the <a href="http://mixitup.io/" rel="nofollow">http://mixitup.io/</a> jquery plugin.</p>
  
  <p>So I created a custom post type, 'portfolio' and in the archive-portfolio.php I created the filters by listing the taxonomy terms of 'portfolio'</p>
  
  <pre><code>&lt;?php $terms = get_terms("portfolio_categories");
               $count = count($terms);
               if ( $count &gt; 0 ){
                   echo '&lt;ul class="list-group"&gt;';
                   foreach ( $terms as $term ) {
                     echo '&lt;li class="list-group-item" data-filter="' . $term-&gt;slug . '"&gt;' . $term-&gt;name . '&lt;span class="badge"&gt; ' . $term-&gt;count . '&lt;/span&gt;&lt;/li&gt;';
  
                   }
                   echo '&lt;/ul&gt;';
               }  
               ?&gt; 
  </code></pre>
  
  <p>So in the first instance I need to get the post count of each term and replace it with what I used and didn't function: <code>$term-&gt;count</code></p>
  
  <p>After creating the filters I need to create the grid so I made a loop to get all the posts in the custom post 'portfolio'</p>
  
  <pre><code>&lt;?php $args = array( 'post_type' =&gt; 'portfolio', 'posts_per_page' =&gt; 99 );
      $loop = new WP_Query( $args );
      $post_number = 0; ?&gt;
   &lt;ul id="portfolio-grid"&gt;
  &lt;?php while ( $loop-&gt;have_posts() ) : $loop-&gt;the_post(); ?&gt;
     &lt;li class=""&gt;&lt;?php echo the_title() ?&gt; &lt;/li&gt;         
  &lt;?php endwhile; ?&gt;
   &lt;/ul&gt;
  </code></pre>
  
  <p>Here I need to assign the category slug of the term in the empty class quotes of the li so that I can make the plugin work properly.</p>
  
  <p>Any chance you can help me with that?</p>