Pergunta

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://localhost/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

Foi útil?

Solução

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

Outras dicas

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.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top