I want to create a custom wordpress template product page using PHP. I don't want to override the default product page, but I want to register my custom template page as a product page. I have created a PHP template page that after doing some processing comes up with a list of product IDs that it wants to display (this processing doesn't have to do with wordpress so I don't use WP_Query to retrieve those IDs). Then, I am using the woocommerce [product] shortcode to display those IDs. The probelm is that if I save this page with a slug of www.website.com/my-custom-page, then the URL www.website.com/my-custom-page works, but the url www.website.com/my-custom-page/?post_type=product yields error 404. The reason I want the second URL to work is because my filters only work when the URL parameter post_type=product is present.

So, does anybody know how I can register my page (or my template) as a wordpress product page? So that the second URL does not give error 404?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.