Forums › Forums › Search & Filter Pro › Issue creating an archive.php for Custom Post Type
- This topic has 10 replies, 2 voices, and was last updated 6 years, 9 months ago by Anonymous.
-
Anonymous(Private) January 31, 2018 at 3:41 pm #156386
Hi everyone,
In order for Search & Filter Pro to work like we would like, we have to make a archive.php for our custom post type. We have experience in making archive.php templates for custom post types but in this case we have to create it using a loop.
We’ve got a custom post type named ‘catalogus’ and made a archive.php for it using these instructions http://www.wpbeginner.com/wp-tutorials/how-to-create-a-custom-post-types-archive-page-in-wordpress/ but unfortunately we’re seeing no results on that archive page.
Could you please point us in the right direction with getting the right archive page?
Trevor(Private) January 31, 2018 at 5:49 pm #156464Have you tried the Custom method on WP_Query?
You can then add the search form to the arguments in your template file:
https://www.designsandcode.com/documentation/search-filter-pro/search-results/custom/#WP_Query
Anonymous(Private) February 1, 2018 at 9:28 am #156649Hi Trevor,
We’ve tried the Custom method on WP_Query. We have also added the search form arguments but the archive page doesn’t show any results.
You can find the code from archive-catalogus.php here: https://gist.github.com/Bjornftw/399679b0dc23004c3645c6976d86689c
The strange thing is, as soon as we add the code ‘search_filter_id’ we won’t see any results anymore. If we delete that line (‘search_filter_id’) we do see results.
Best regards,
RobinAnonymous(Private) February 2, 2018 at 9:34 am #156947Hi Trevor,
Thanks. We’ve removed it. Now we do see the archive page on http://staging.lunaworx.nl/catalogus but somehow the filters don’t seem to work. Whatever we do (select a price range with the slider or search on a specific term) we always get all of the results.
Best regards,
Robin -
AuthorPosts