list of all post from the current taxonomy of custom post type

admin

Administrator
Staff member
I am creating <strong>custom post type(cpt)</strong> called
Code:
circular
. and the taxonomy for the <strong>cpt</strong> is
Code:
circular_category
in wordpress

What I want to achieve is generate a list of the titles of all circular custom post type in current taxonomy page.
the permalink
Code:
/circular_category/free-circular/

I tried with this code with no luck, any ideas?
Here are some variable that can be add to the query

Code:
$cir_cat   = $wp_query-&gt;get_queried_object();
$cat_name  = $cir_cat-&gt;name;
$cat_id    = $cir_cat-&gt;term_id;
$cat_slug  = $cir_cat-&gt;slug ;

<strong>The Query</strong>

Code:
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$args = array(
    'post_type' =&gt; 'circular',
    'posts_per_page' =&gt; -1,
    'order' =&gt; 'DESC',
    'orderby' =&gt; 'post_title',
    'category__in' =&gt; $cat_id,
    'paged' =&gt; $paged,
    'tax_query' =&gt; array(
        array(
            'taxonomy' =&gt; 'circular_category',
        )
    )
);
$circular_query = new WP_Query( $args );

Now display the list cpt post from current cpt category

Code:
&lt;ul id="circulars"&gt;
&lt;?php
if($circular_query-&gt;have_posts()) :
    while($circular_query-&gt;have_posts())  : $circular_query-&gt;the_post();
    ?&gt;
        &lt;li&gt;
            &lt;a href="&lt;?php the_permalink() ?&gt;" title="Link to &lt;?php the_title_attribute() ?&gt;"&gt;
             &lt;?php get_the_title(); ?&gt; 
            &lt;/a&gt;
        &lt;/li&gt;           
    &lt;?php endwhile; ?&gt;
        &lt;/ul&gt; 
    &lt;?php 

    $total_pages = $circular_query-&gt;max_num_pages;
    if ($total_pages &gt; 1){
        $current_page = max(1, get_query_var('paged'));
        echo paginate_links(array(
            'base' =&gt; get_pagenum_link(1) . '%_%',
            'format' =&gt; '/pages/%#%',
            'current' =&gt; $current_page,
            'total' =&gt; $total_pages,
            'prev_text'    =&gt; __('« prev'),
            'next_text'    =&gt; __('next »'),
        ));
    }
    ?&gt;    
&lt;?php else :?&gt;
&lt;h3&gt;&lt;?php _e('No Circular found', ''); ?&gt;&lt;/h3&gt;

&lt;?php endif; ?&gt;
&lt;?php wp_reset_postdata();?&gt;