Wordpress shows all custom taxonomies and their associated posts.

Is there any way in Wordpress custom taxonomy to show all categories and link their messages, as well as the means:

my category1 post 1 post 2 post 3 post 4 my category2 post 1 post 2 post 3 post 4 

note I have to do this in a custom post type, taxonomy.

+4
source share
1 answer

this should work, I have not tested it thoroughly

 $args = array ( 'type' => 'post', //your custom post type 'orderby' => 'name', 'order' => 'ASC', 'hide_empty' => 0 //shows empty categories ); $categories = get_categories( $args ); foreach ($categories as $category) { echo $category->name; $post_by_cat = get_posts(array('cat' => $category->term_id)); echo '<ul>'; foreach( $post_by_cat as $post ) { setup_postdata($post); echo '<li><a href="'.the_permalink().'">'.the_title().'</a></li>'; } echo '</ul>'; } 

A source:
http://codex.wordpress.org/Function_Reference/get_categories
http://codex.wordpress.org/Template_Tags/get_posts

questions just ask

+3
source

All Articles