生命不息,奋斗不止/创造价值-传递价值-获得价值
所谓迷茫,就是才华配不上梦想 每一个让你难堪的现在,都有一个不够努力的曾经

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

赞(0)
未经允许不得转载:jack361博客 » wordpress获取自定义文章类型

如果你爱我或恨我,请↓

联系我