Search code examples
wordpresscustom-post-type

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


Solution

  • 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