- This topic has 14 replies, 2 voices, and was last updated 9 years, 6 months ago by piotrly.
-
AuthorPosts
-
19 March 2015 at 11:03 #6189piotrlyParticipant
After upgading Event Maker to v 1.5.0 sorting of my regular posts changed – the oldest news are at top of page. When I disable this plugin, sorting is back as normal (newer posts are first).
19 March 2015 at 11:13 #619019 March 2015 at 11:20 #6192BartoszKeymasterCan you do some code modifications on your site to check if that solves the issue?
Go to plugin folder/includes/class-query.php
Find alter_orderby_query function, line 741 and right after this:
if (is_admin()) return $query; if (empty($query)) return $query;
insert this:
$post_types = $query->get('post_type'); // does query contain post type as a string or post types array if(is_array($post_types)) { // check if there are defferrnces between the arrays if((bool)array_diff($post_types, apply_filters('em_event_post_type', array('event')))) // at least one of the post_types is not an event post type, don't run the query $run_query = false; else // all the post type are of event post type $run_query = true; } else $run_query = (bool)in_array($post_types, apply_filters('em_event_post_type', array('event'))); // do sorting or not if(!$run_query) return $query;
19 March 2015 at 12:16 #6194piotrlyParticipantGreat, it works! Thanks.
19 March 2015 at 12:27 #6195BartoszKeymasterDid you notice any other issues? There were some heavy modifications of the code.
19 March 2015 at 12:44 #6196piotrlyParticipantI’m not sure if it’s related with this change but when I enabled plugin, links to events doesn’t work. So I can’t check if everything is ok with events page. But even if I restore class-query.php, links are still not working. Maybe it need some time to refresh and it’s related with disabling and enabling of plugin.
But definitely it fixed order of my posts.19 March 2015 at 12:46 #6197BartoszKeymasterJust re-save your permalinks. That’s what usually helps.
19 March 2015 at 13:19 #6198piotrlyParticipantThanks for tip, it worked. Everything seems fine with events, it looks like earlier.
I noticed one strange thing – but it’s independent if I use modified class-query.php or not. I have only one future event and when I enabled displaying past events and on page with list of events I changed order (from drop-down list) to descending my past event from 9 March is first, then my future event from 8 April and then event from 11 February. Maybe it’s some other bug:
http://powietrze.malopolska.pl/en/wydarzenia/?orderby=event_end_date-descEdit: in ascending order is also wrong
19 March 2015 at 13:34 #6199piotrlyParticipantOk, I checked that default view has right order but changing order (from drop-down list) to descending or ascending couses that order is wrong.
19 March 2015 at 13:35 #6200BartoszKeymasterHmm, strange. It behaves the same if you change ordering and then switch to start date asc again.
Piotr, we’ll try to find what is the logic here and I’d be greatuful if you do the same on your site (nice one, by the way)
19 March 2015 at 13:36 #6201BartoszKeymasterYeah, but for one or first item only.
19 March 2015 at 14:29 #6202piotrlyParticipantOk, I’ll try several options in the evening by adding new events.
19 March 2015 at 18:56 #6203piotrlyParticipantThere was something wrong with this particular event. I don’t know reason of this but I deleted this event and added it again with the same date. Sorting is working fine now.
19 March 2015 at 19:14 #6204BartoszKeymasterDid your create that one by duplicating it?
19 March 2015 at 19:46 #6206piotrlyParticipantNo, I just created new one and copied description.
I was testing creating new events and all worked fine except this one. -
AuthorPosts
- You must be logged in to reply to this topic.
How to Get Support
After you register and login to the site, you may post all plugin support questions in the Support Forum.
If you need to provide private info, please create a ticket and then reply to it using Set as private reply option.
Sign Up
Please login or sign up for a free account.Sign Up Now