开发者

wordpress custom post type

So I've just made a custom post type for my wordpress theme named "Products". When I create a new post in it and view it, the link is something like this:

"http://localho开发者_运维知识库st/wordpress/product/a-product-title"

This page views as expected but when I try to go to the supposed parent page:

"http://localhost/wordpress/product/"

I get a 404 error page. Is there a special template I need to make to view this page?

Thanks


I found what to do. I just created a new page called "Products" and set it as the posts page. Then I put this in front of the loop

$wp_query = new WP_Query("post_type=product");

and it worked


I had the same issue - I think it's down to the fact that right now, WP 3.0 simply does not behave as you would expect with custom post type 'archives'.

Check out Smarter Custom Posts to easily build-in this behaviour.


The name Products is also used by Woocommerce so be aware that if you install this too, the custom post type will stop working.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜