Support

Home Forums Event Espresso Premium Sort events by "menu order"

Sort events by "menu order"

Posted: February 1, 2024 at 2:22 pm

Viewing 4 reply threads


hoboken

February 1, 2024 at 2:22 pm

Before the recent major upgrade, I was able to sort Events on an Event Category page using the following snippets (which I believe your support team provided):


// Add "Menu Order" support to the Event Espresso "espresso_events" custom post type
add_filter( 'FHEE__EE_Register_CPTs__get_CPTs__cpts', 'ee_modify_page_attributes_of_event_espresso_cpt' );
function ee_modify_page_attributes_of_event_espresso_cpt( $cpt_registry_array ) {
if ( isset( $cpt_registry_array['espresso_events'] ) ) {
$cpt_registry_array['espresso_events']['args']['supports'] = array(
'title',
'editor',
'author',
'thumbnail',
'excerpt',
'custom-fields',
'comments',
'page-attributes'
);
}
return $cpt_registry_array;
}

// Set the query orderby for the event category archives
function order_espresso_event_categories( $query ) {
$query->set( 'orderby', 'menu_order' );
$query->set( 'order', 'ASC' );
return $query;
}

But now, after the update, the “Event Attributes” meta box is missing from the Event edit pages. Is there something I need to revise in the code?


Tony

  • Support Staff

February 5, 2024 at 4:57 am

Hi there,

Where on the site do you have the above code?

I ask because I’ve just added the above snippet to a test site using the latest version and the Event Attributes section loads for me:

https://monosnap.com/file/hs4xMqfeXrtfdOurZLNkcqvlkJQdKn


hoboken

February 5, 2024 at 5:20 am

I’ve got the snippet in functions.php


hoboken

February 5, 2024 at 5:22 am

If it matters, we’re using the Classic Editor.


Tony

  • Support Staff

February 5, 2024 at 5:45 am

I’ve got the snippet in functions.php

That may be too late in the request (although it shouldn’t be).

Try using a custom functions plugin to hold custom code:

https://eventespresso.com/wiki/create-site-specific-plugin-wordpress-site/

If it matters, we’re using the Classic Editor.

Shouldn’t make a difference within EE.

But, by this do you mean the WP classic editor plugin or EE ‘legacy editor’ option within EE -> Events -> Defautl Settings?

Viewing 4 reply threads

The support post ‘Sort events by "menu 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