Home › Forums › Calendar Products › Events Calendar PRO › Event Category Filtering not working on AJAX views with ver 3.10
- This topic has 7 replies, 3 voices, and was last updated 8 years, 9 months ago by Support Droid.
-
AuthorPosts
-
June 29, 2015 at 12:24 pm #973629Matthew W KannerParticipant
I am doing some custom filtering based on event categories. I have 3 categories I am excluding from all views (except when specifically viewing one of these categories). I worked out the code and had it working both on page load and the AJAX updates (when going Previous/Next) by using the ‘tribe_events_pre_get_posts’ hook.
It was working great, that is, until I upgraded to version 3.10.
You can see the code here: http://pastebin.com/SpRcauKx
I’m hoping there is something I can do to make this work again. It does work when I first load any view (List, Day, or Month), however as soon as you use one of the Prev/Next links, the AJAX refresh seems to ignore the custom filtering. However, prior to these plugin versions it was working (on 3.7 and 3.9).
I understand this is a customization which you can’t always necessarily support, but any help or pointers you could give would be much appreciated since it worked in the previous version of the code.
June 30, 2015 at 8:25 am #973885BrianKeymasterHi,
Thanks for using our plugins.
I can try to help out here.
I loaded up the snippet and see it working as you said on the initial load.
However, it does not appear the hook it is connected to runs on the Ajax call for the next and previous pages.
It maybe you can change the priority on the action you are using and see if that can get it. I do not have any other ideas at this time.
Let me know if you have any follow up questions.
Thanks
June 30, 2015 at 9:11 am #973918Matthew W KannerParticipantOK, I tried changing the priority but still not luck (tried values of 5 and 10 for priority).
In previous versions of the plugin, this hook did run on the AJAX load. I know lots of changes were made in the 3.10 release though. Is there a way for you to find out from a developer if there is an additional hook I need to use now? I read through the release notes (which were great – thank you!), but didn’t find anything that seemed to address it.
Thanks!
July 3, 2015 at 10:31 am #975225BrianKeymasterSorry for the delay here. Your ticket got assigned to another Brian and I missed it.
We are out for the 4th right now, but next week I can see about that hook.
Thanks
July 6, 2015 at 8:51 am #976171BrianKeymasterOk that hook is the only hook available we did not make changes there.
However, I did get another pair of eyes on the coding and this part maybe causing the issue:
//If we're in the admin, make no query alterations
if ( is_admin() )
return $query;I removed that and it seem to work for me on my site. Since the events are being loaded by ajax it is actually in the admin when the query is modified and that conditional there would stop it from working.
Let me know how that works out.
Cheers
July 6, 2015 at 9:01 am #976191Matthew W KannerParticipantHmmm….OK, that would make sense. I didn’t know the AJAX was happening on the Admin side of things. I didn’t use to have that in there, but I added it when I realized that the admin events were also being filtered out (and therefore couldn’t be edited). I will address that issue in another way.
Thank you so much. I feel foolish having it be so simple, but I appreciate the extra eyes helping to sort it out. I will replace it with a different type of check.
- This reply was modified 8 years, 9 months ago by Matthew W Kanner.
July 6, 2015 at 10:57 am #976222BrianKeymasterYep, all ajax in WordPress goes through:
/wp-admin/admin-ajax.php
To target the frontend only you could look to using this conditionals:
https://gist.github.com/jo-snips/2415009
Let me know if you can get that to work.
Thanks
July 21, 2015 at 7:05 am #988367Support DroidKeymasterThis topic has not been active for quite some time and will now be closed.
If you still need assistance please simply open a new topic (linking to this one if necessary)
and one of the team will be only too happy to help. -
AuthorPosts
- The topic ‘Event Category Filtering not working on AJAX views with ver 3.10’ is closed to new replies.