Forums › Forums › Search & Filter Pro › Archive templates
- This topic has 9 replies, 2 voices, and was last updated 6 years, 7 months ago by
Trevor.
-
Anonymous(Private) October 25, 2019 at 12:52 pm #224640
I have a form which shows results using the post type archive method. I’ve also enabled filtering on the taxonomy archives.
When I first load the event archive eg. mysite/events, it uses these archive_event.php template (as expected).
If I select an event category (eg. festivals) and run the search on that, it charges the url to mysite/events/eventcategory/festivals (as expected) HOWEVER the template remains as archive-event.php (whereas it should be taxonomy-eventcategory.php).
If I then referesh that page (without changing anything on the form), it correctly uses the taxonomy-eventcategory.php instead.
If I clear the search, the url changes back to mysite/events but the page continues using the taxonomy archive template, until I refresh the page, whereupon it changes back to post type archive page.
Any idea why the templates are not getting updated when a search is run/urls change?
With many thanks in advance.
Anonymous(Private) October 25, 2019 at 4:36 pm #224678Ah thank you Trevor. That makes sense and I can see that disabling Ajax does fix the problem.
What are the main advantages of using Ajax? Is it quicker? Am I losing any other functionality if it’s disabled? I guess if I really wanted to use Ajax I could just make both templates the same which shouldn’t be a problem…
Anonymous(Private) October 25, 2019 at 5:10 pm #224694Thank you again. I think I’d prefer to use Ajax and I can make the templates the same, although I notice that one other advantage of disabling it is as follows –
I have an option at the top of the search results where the user can choose to view them in a grid or list view. This works fine on the first page but when they click to the next page (I use WP Page-Navi), whatever setting the user has chosen is ignored and it goes back to the default.
If I disable Ajax, whatever option the user has selected is persisted for subsequent pages.
Can you explain why using Ajax causes this setting to be ignored and/or suggest any way of overriding it?
Trevor(Private) October 25, 2019 at 5:21 pm #224700It will be because the List/Grid choice section code is outside of the Ajax Container specified in the form settings by you. You would need to find a jquery selector that includes both, and the code that sets the view type would have to be renewable with ajax (which may well not be possible. I would be inclined not to use Ajax in your case.
Anonymous(Private) October 25, 2019 at 5:33 pm #224704Hmm… I could certainly move the List/Grid choice section code into the Ajax Container but from what you say it sounds as if that’s only part of the problem, and I don’t entirely understand the rest of what you say(!) so I’m guessing you’re probably right and it would make life simpler not to use it at all.
The frustrating thing is that the List/Grid selector does work when switching between views on each individual page, it just doesn’t persist that selection from one page to the next…
I don’t suppose somehow using the Ajax pagination selector (currently set at the default of “.pagination a”) would make any difference?
Anonymous(Private) October 25, 2019 at 6:01 pm #224710Ha… point taken Trevor 😉
Bizarrely upon further investigation, I’ve just discovered that when using Ajax, the template used *does* actually change, despite the fact that both plugins I’m using to monitor such things (ie. Query Monitor and What the File) both report that it hasn’t changed!
Not quite sure what to make of that information or whether I can make use of that knowledge but I’ll try to leave you in peace now and figure things out a bit more for myself.
Many thanks again.
-
AuthorPosts