 <pre><code>&lt;?php if ( get_query_var('paged') ) { $paged = get_query_var('paged'); } elseif ( get_query_var('page') ) { $paged = get_query_var('page'); } else { $paged = 1; } $q_cat = get_query_var('cat'); $cat = get_category($q_cat); $catName = $cat-&gt;cat_ID; $category = new WP_Query(); query_posts( array( 'post_type' =&gt; 'producto', 'paged' =&gt; $paged, 'cat' =&gt; $catName ) ); if ( have_posts() ) : $count = 0; while ( have_posts() ) : the_post(); $count++; get_template_part('content', get_post_format()); endwhile; else: ?&gt; &lt;?php _e('sorry no posts', 'siddharta naranjo') ?&gt; &lt;?php endif; ?&gt; </code></pre>