开发者

Link to page with custom posts?

I've created this theme with some custom post types called projects and events.

I now want to link to a "archive page" all the posts with that post type. H开发者_JAVA技巧ow is that possible?

Thanks!


try wp_query class you can cusomize it with the post type. read more here http://codex.wordpress.org/Class_Reference/WP_Query#Type_.26_Status_Parameters

then you may do so with a condition to change the code in achhive page from:

if (have_posts()) : while (have_posts()) : the_post();

to:

$cat_posts = new WP_Query($query_string."post_type=projects");
if ($cat_posts->have_posts()) : while($cat_posts->have_posts()) : 
    $cat_posts->the_post();
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜