Support

Home Forums Event Espresso Premium EE4 Upcoming Events Widget – Show Events in Alphabetical order

EE4 Upcoming Events Widget – Show Events in Alphabetical order

Posted: August 29, 2014 at 1:29 pm


Jenny Volvovski

August 29, 2014 at 1:29 pm

Hi,
I am trying to alphabetize the events that appear in the widget, instead of having them organized by start date. I still want to exclude expired events.

Please let me know if this is doable.

Thanks,
Jenny


Josh

  • Support Staff

August 29, 2014 at 3:15 pm

Hi Jenny,

It is doable. If you open up the upcoming events widget file, you’ll see where it runs the query. You can change the order_by paramter to 'EVT_name' and it will order the events alphabetically by name. Example code follows:

// run the query
$events = EE_Registry::instance()->load_model( 'Event' )->get_all( array(
    $where,
    'limit' => $instance['limit'] > 0 ? '0,' . $instance['limit'] : '0,10',
    'order_by' => 'EVT_name',
    'order' => 'ASC',
    'group_by' => 'EVT_ID'
));

Please note that if you make this change directly to the plugin file, it will get wiped out on the next update. You can avoid this by cloning the default widget into its own little plugin. I made a copy of the widget and packed it up into a little plugin, which you can get a copy of the code from here:

https://gist.github.com/joshfeck/27a285c4285a6c986053

  • This reply was modified 5 years, 2 months ago by  Josh. Reason: code formatting


Jenny Volvovski

August 29, 2014 at 3:33 pm

Perfect!

Thanks so much!
Jenny


Josh

  • Support Staff

August 29, 2014 at 5:05 pm

You’re welcome.

The support post ‘EE4 Upcoming Events Widget – Show Events in Alphabetical 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.

Support forum for Event Espresso 3 and Event Espresso 4.
Documentation for EE3 and EE4
Documentation for Event Espresso 3

Documentation for Event Espresso 4

Status: closed

Updated by  Josh 5 years, 2 months ago ago

Topic Tags

Notifications

This topic is: not resolved
Do NOT follow this link or you will be banned from the site!
[for="input_96_5_3"]
[for="input_96_5_3"]
[gravityform id=96 title=false description=false]
  • This field is for validation purposes and should be left unchanged.
[i]
[i]
[gravityform id=69 title=false description=false]
  • This field is for validation purposes and should be left unchanged.