Support

Home Forums Event Espresso Premium events in widget in descending order

events in widget in descending order

Posted: November 20, 2015 at 8:26 pm


Ray Rolando

November 20, 2015 at 8:26 pm

hi-
I used the event espresso widget to display most recent events. I put it to show past events and to show 1 at a time. The events show in ascending order so the oldest event shows first. Is there a way to reverse that so the events show in descending order?

https://rayrolando.com/the-latest-from-ray-rolando/

Click that link and bottom right in that box you’ll see the events widget showing in descending order.

Please advise.


Lorenzo Orlando Caum

  • Support Staff

November 21, 2015 at 8:04 am

Hi, that looks like it is [ESPRESSO_EVENTS] in that area. Are you using the sort parameter?

http://cl.ly/image/0E2127193o0D


Lorenzo


Ray Rolando

November 21, 2015 at 8:22 am

No I am using the Upcoming events Widget. I like the formatting of the widget MUCH better, so I’d like to get this to work.

This is the widget in question:
http://devv.rayrolando.com/wp-content/uploads/2015/11/Screen-Shot-2015-11-21-at-10.16.16-AM.png

FYI- The formatting when using the widget looks like i have it here on this page: https://rayrolando.com/the-latest-from-ray-rolando/

When using a shortcode this is the formatting:
http://devv.rayrolando.com/wp-content/uploads/2015/11/Screen-Shot-2015-11-21-at-10.20.42-AM.png

Is there CSS or something I could use in the widget to change to descending order? I’d imagine descending order is more preferable overall to most anyway it’s surprising that this is the widget’s native behavior.

Please advise


chrisscottuk

November 22, 2015 at 3:37 pm

I second this request, would love the widget to be improved like this. Not being able to change the order of past events doesn’t make much sense, as the current order is oldest first, which works for future events, but not for past ones.


Tony

  • Support Staff

November 23, 2015 at 4:17 am

Hi there,

The widget currently orders the events ASC so that the next upcoming event is at the top of the list/first. So you would like to display the next upcoming event last?

I have created a feature request to discuss including a sort field within the default widget, however as it’s a standard WP widget you can copy the default widget and place it within a Site Specific Plugin, then make amendments to the widget there to create a custom version, for example here’s a copy of the widget that includes a sort field:

https://gist.github.com/Pebblo/d0d5f485ae0599e56e20

Add that as a custom plugin, activate it and you’ll have a ‘Custom Event Espresso Upcoming Events Widget’ with a sort field.


chrisscottuk

November 23, 2015 at 11:33 am

Hi Tony,

To help you understand the use for this. I wish to use 2 events widgets, one for upcoming events, and the other for previous events. It is the previous events that requires the descending sort order.

Thanks so much for creating the custom plugin, I’ve tested it, and sadly there is a small problem. The title of the widget is displayed as either ‘asc’ or ‘desc’ depending on the sort order selection.
I am not familiar with php, so a bit out of my depth figuring out what is wrong.

If you could fix this, then this would be awesome! I know this request does appear in the forums from time to time, so others would be pleased too.

A 2nd request to make this the perfect EE4 plugin/widget – would be to allow the widget to display ONLY expired events. At the moment, me and others in these forums use a workaround of using a category called ‘expired’ that we manually assign to each event once it has passed, and then set the widget to display only that category.

If you were easily able to do this, then you would have quickly solved a long running frustation, and this would be totally awesome

Thanks,

Chris


Tony

  • Support Staff

November 23, 2015 at 12:29 pm

Thanks so much for creating the custom plugin, I’ve tested it, and sadly there is a small problem. The title of the widget is displayed as either ‘asc’ or ‘desc’ depending on the sort order selection.
I am not familiar with php, so a bit out of my depth figuring out what is wrong.

Apologies, that’s my fault, I missed some debug code in the widget. I’ve update my gist and remove that code, the widget will no longer display the sort value. You’ll need to delete the current version and re-download.

I’ll see what I can do about the show only expired option.


chrisscottuk

November 23, 2015 at 5:13 pm

Hi Tony,
I noticed that the widget title wasn’t displayed properly, I think I’ve fixed it, by copying some code over from the original EE4 widget.
I’ve commented on your gist, with the link to my fork with the fix included.

Hope this helps.


Tony

  • Support Staff

November 24, 2015 at 3:31 am

Hmm, not sure how I missed that from the gist! Thanks.

I’ve also updated the gist with a new version of the widget which I think you may like to test out – http://take.ms/IAYqQ

Please let me know if it works as expected 🙂


chrisscottuk

November 24, 2015 at 1:21 pm

Hi Tony,

Thank you, Thank you, Thank you! It works really well, and exactly what I need, and have been waiting for.

Now the code is written, may I suggest that you consider rolling this update into EE4

It’s support like this which really give me confidence in EE4 as a platform. Thanks again,
Chris


Tony

  • Support Staff

November 24, 2015 at 1:58 pm

You’re most welcome Chris.

I have already created a ticket to discuss including this within the core plugin. We try to keep the options available within EE to a minimum as we have previously had feedback that the options were confusing.

Adding multiple options for each individual request easily stacks up to a wall of options that just cause support nightmares 🙂 So we need to consider the best way to move forward with this (it may well just be to include the options, but it needs to be discussed) which is why I didn’t just push it directly to core.

Anyway, for the time being the above plugin will work, we’ll include notes in the change log if this is included within core.

Let us know if you have any further problems.

The support post ‘events in widget in descending order’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso