Forums › Forums › Search & Filter Pro › Unable to enable search on an Archive page
- This topic has 8 replies, 2 voices, and was last updated 4 years, 7 months ago by Trevor.
-
Anonymous(Private) May 31, 2020 at 10:41 am #246673
Hi there,
i’ve purchases Search & Filter Pro and am looking to have independent search forms on each of the 2 CPT archive pages I have. I’ve added the search form to the respective archive-{slug}.php templates but can’t for the life of me figure out how to make the results show up??
I’ve selected “As a Post Archive” from the “Display Results” tab, and still nothing…
Anonymous(Private) June 2, 2020 at 11:40 am #246893Hi Trevor,
I managed to get something loading via displaying results “As an Archive”, however, it doesn’t look like the search is actually searching anything?
It looks to just be reversing the order of the results already on the page but not actually filtering.
Any ideas?
Trevor(Private) June 3, 2020 at 12:56 pm #247143I can see the problem. Your footer is not calling the wp_footer function, and so our javascript is not loading. Or, if the theme footer file IS calling wp_footer, something is stopping it from calling the file.
So, if you cannot fix it in the theme footer file, this means you must load (enqueue) the file manually, from the child theme functions.php file.
The URL looks like this:
…/wp-content/plugins/search-filter-pro/public/assets/js/search-filter-build.min.js
You would need to add this as an enqueued file.
Something like this in the child theme (it must be a child theme unless the theme is totally bespoke to you (and thus not going to be updated by a theme author)) functions.php file:
function search_filter_pro_enqueue_script() { wp_enqueue_script( 'search-filter-build', 'https://yourwebsite.com/wp-content/plugins/search-filter-pro/public/assets/js/search-filter-build.min.js' ); } add_action('wp_enqueue_scripts', 'search_filter_pro_enqueue_script');
Replace
https://yourwebsite.com
with yours of course!Anonymous(Private) June 7, 2020 at 2:14 pm #247760Hi Trevor,
I’ve tried adding both the wp_footer function to the footer.php of my custom template, as well as the code snippet you shared to the functions.php file but no luck.
It doesn’t look like the behaviour has changed at all. The search itself doesn’t seem to be working?
-
AuthorPosts