wordpress - How get custom post with taxanomy? -


i know, have use class wp_query , loop, can't custom post database taxonomy, example, category documents. reading, had use template 'taxonomy-{slug}', dont know, how can posts of taxonomy.

for example, clicking link http://mysite/categorydocuments/private' , getting post post_type 'documents' , taxonomy categorydocuments''.

how can taxonomy private , put taxonomy in $args wp_query? please, don`t offer me variable parse link.

change value of $post_type custom post type name if using custom post type

$post_type = 'post';  // taxonomies post type $taxonomies = get_object_taxonomies( (object) array( 'post_type' => $post_type ) );  foreach( $taxonomies $taxonomy ) :     // gets every "category" (term) in taxonomy respective posts   $terms = get_terms( $taxonomy );    foreach( $terms $term ) :       $posts = new wp_query( "taxonomy=$taxonomy&term=$term->slug&posts_per_page=2" );      if( $posts->have_posts() ): while( $posts->have_posts() ) : $posts->the_post();         //do general query loop here       endwhile; endif;    endforeach;  endforeach; 

Comments

Popular posts from this blog

javascript - Slick Slider width recalculation -

jsf - PrimeFaces Datatable - What is f:facet actually doing? -

angular2 services - Angular 2 RC 4 Http post not firing -