Recently after the update we found Events no longer showing properly. We did find the way to fix this in another forum ( https://toolset.com/forums/users/nigel-a/) . Changing the ordering from 'custom field' to 'number' worked for the most part, however events that last more than one day are appearing out of proper order.
Apparently the Event Calendar field ( _EventStartDate) must be formatting one-day and two-day dates differently. Please help! What can we do? We are paid customers for Toolset and for The Event Calendar Pro. There has to be some way that we can make these 2 talk to each other. It was all working perfectly before your recent update.
Link to a page where the issue can be seen: hidden link
1. Apparently, the Event Calendar field ( _EventStartDate) must be formatting one-day and two-day dates differently.
That would be a problem, because you cannot sort by NUMBER or DATE or else simultaneously, in the Views.
2. What Update? Events Cal or Toolset? Do you have a copy of the working version of the site?
We could check what happened exactly.
Since it seems to be Toolset's update, there should be made a fix for it, of course.
3. Can you as well check, that you filter by NUMBER and not DATE, in no case?
Also, please consider this:
https://toolset.com/forums/topic/date-comparison-error-with-tribe-events-calendar-after-update/
https://toolset.com/forums/topic/the-event-calendar-todays-event-not-showing/
Sorry this is the forum link I meant to connect you to. https://toolset.com/forums/topic/date-comparison-error-with-tribe-events-calendar-after-update/
We have the filter set to numbers not date. The update was specifically Toolset. It worked fine before that.
Hello,
I assume we are talking about the plugin "The Events Calendar"
https://wordpress.org/plugins/the-events-calendar/
And you are going to query the "Events" posts, and order the result by custom field "_EventStartDate".
I have tried it in my localhost, it shores value in custom field "_EventStartDate" as string format, for example:
2018-11-23 00:00:00
2018-11-02 00:00:00
2018-11-04 00:00:00
So you can edit your post view, in section "Ordering", setup it as "As a native custom field"
see screenshot order-by.JPG
That is how we initially had it. The method you mention stopped working on the last update. That is why we set it like this recent post told us to: https://toolset.com/forums/topic/date-comparison-error-with-tribe-events-calendar-after-update/
However in doing that only the single day events show up in order, now the multi day events do not. (see earlier screenshot).
I had already tested with the multi day events, it works fine, see my answer:
https://toolset.com/forums/topic/events-no-longer-appear-in-the-correct-order/#post-1133280
I suggest you check these:
1) In case it is a compatibility problem, please deactivate other plugins, and switch to wordpress default theme 2017, and test again
2) If the problem still persists, please provide database dump file(ZIP file) of your website, also point out the view URL, I need to test and debug it in my localhost, thanks
https://toolset.com/faq/provide-supporters-copy-site/
Thanks for the details, I can import the database dump file, I assume the table pre-fix is "wpfd_",
I have tried these:
1) Edit the post view "View Featured Spotlight Events for Home", in section "Ordering", switch to option "As a native custom field"
2) In section "Loop item in Featured Events for Home Page View", at the bottom, add a shortcode to display the "_EventStartDate" field value:
[wpv-post-field name="_EventStartDate"]
3) Test it in home page, it works fine, see screenshot event-order.JPG
Those items are display correctly in ascending order.
And the shortcode [wpv-post-field name="_EventStartDate"] does output the event start date correctly.
Is there anything missing?
The screenshot doesn't look right: it's showing dates from 2014 instead of current dates. We should be seeing dates from the current date forward in order. We want to show all events from today's date forward.Please visit the home page of the live site: hidden link scroll down to Featured Upcoming Events. Make note of the 3 events showing and in what order. Then reload your screen. You will notice that the events are changing randomly every time you reload and they are not in order. Every time you reload it changes. This should not be happening.
Yes, you are right, I have added below codes codes in theme file functions.php:
function tssupp_filter_event_query( $view_args, $view_settings, $view_id ){
if($view_id != 4219) return $view_args;
if ( ! isset( $view_args['meta_query'] ) ) {
$view_args['meta_query'] = array();
}
$meta_query = array(
'key' => '_EventStartDate',
'value' => date("Y-m-d H:i:s"),
'type' => 'NUMBER',
'compare' => '>'
);
$view_args['meta_query'][] = $meta_query;
return $view_args;
}
add_filter( 'wpv_filter_query', 'tssupp_filter_event_query', 101, 3 );
Now it does output the upcoming event posts, see screenshot:
event-order2.JPG
And the results are order by the "_EventStartDate" field correctly, I have tried reload the home page lots of time, the results are not changed, see above screenshot, so there should be some other custom codes/plugin/theme are changing the view's result, as I mentioned above, you will need to check this in your website:
In case it is a compatibility problem, please deactivate other plugins, and switch to wordpress default theme 2017, and test again
Can you clarify: do I need to ADD that code to my functions.php?
Those PHP codes are copied from this thread you mentioned above:
https://toolset.com/forums/topic/date-comparison-error-with-tribe-events-calendar-after-update/
I am not sure where you have put them, maybe it is in your theme file "functions.php".
And the key problem is that:
There isn't similar problem in my localhost with a fresh wordpress installation, Views can order by the custom field _EventStartDate correctly.
As my above answer:
In case it is a compatibility problem, please deactivate other plugins, and switch to wordpress default theme 2017, and test again
Ok we have spent a whole day setting this up on a dev site on another server. Its even a different web host. We've switched to a default theme and turned off all other plugins. It still is out of order.
Here is the dev site: hidden link
Please try reloading the page at least 3 times. Included are screencaps of what happens when I do so.
We don't know what else to try.
There isn't similar problem with only your database dump file in my localhost,I have tried to fresh the page lots of time, and get the same result, see screenshot, events.JPG
Please provide your test site credentials +FTP access in below private message box, I need a live website to test and debug. thanks
Thanks for the details, I have done below modification in your website:
1) Edit the view "View Featured Spotlight Events for Home",
in section "Ordering", setup it as "Ascending" + "As a native custom field", more details, please check my first answer:
https://toolset.com/forums/topic/events-no-longer-appear-in-the-correct-order/#post-1133280
2) Then test it again in the front-page, it works fine, see screenshot: