循环浏览wordpress3.0+自定义post类型分类法
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了循环浏览wordpress3.0+自定义post类型分类法相关的知识,希望对你有一定的参考价值。
Wordpress 3.3 custom post type query that will get all of the taxonomies, loop through them, and output the posts from each.
//for a given post type, return all $post_type = 'energy-link'; $tax = 'category'; $tax_terms = get_terms($tax); if ($tax_terms) { foreach ($tax_terms as $tax_term) { echo ' <div class="wrap_the_tax"> '; 'post_type' => $post_type, 'taxonomy' => $tax, 'field' => 'slug', 'terms' => $tax_term->slug ) ), 'post_status' => 'publish', 'posts_per_page' => -1, 'orderby' => 'title', 'order' => 'ASC', 'operator' => 'IN' ); // END $args $my_query = null; $my_query = new WP_Query($args); //debug($my_query); if( $my_query->have_posts() ) { while ($my_query->have_posts()) : $my_query->the_post(); echo sces_smallblock( $post->post_title, $post->post_excerpt); endwhile; } // END if have_posts loop wp_reset_query(); echo ' </div> '; } // END foreach $tax_terms } // END if $tax_terms
以上是关于循环浏览wordpress3.0+自定义post类型分类法的主要内容,如果未能解决你的问题,请参考以下文章