获取自定义文章类型和普通文章一样
比如普通的文章调用:
<?php $args = array( 'post_type'=>'post', //调用文章类型为post 'showposts'=>10, ); query_posts($args); if( have_posts() ) : while( have_posts() ) : the_post(); /*****************/ endwhile;endif; ?>
调用自定义的文章类型,假设为book:
<?php $args = array( 'post_type'=>'book', //调用文章类型为book 'showposts'=>10, ); query_posts($args); if( have_posts() ) : while( have_posts() ) : the_post(); /*****************/ endwhile;endif; ?>
只是post_type参数不一样