wordpress获取自定义文章类型

获取自定义文章类型和普通文章一样

比如普通的文章调用:

<?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参数不一样

© 版权声明
THE END
喜欢就支持一下吧
点赞0 分享
评论 抢沙发

请登录后发表评论

    暂无评论内容