I’m using the EventOn plugin and I would like to present the events using the “Post Loop Builder” from Salient Theme, but it does not have the option to order by Event Date.
I went override the query via a child theme to specify a custom order.
I used in my child functions.php like so: https://pastebin.com/JC4Jhpa1
But this not worked.
Can you help me? Used I the correct value for “orderby”?
- Jan 4,2024 AT 11:54AM - 2 years agoHello,
Instead of evcal_start_date, please try
evcal_srow UNIX event start value
evcal_erow UNIX event end value
From this guide:
https://docs.myeventon.com/documentations/event-post-meta-variables/
Did not work.
I contacted the developers of the Salient theme, and they responded with the following:
“You’ll likely need to do a custom meta query instead of directly adding it into the orderly if it’s a custom key. I would reach out the EventOn developers for a snippet since the plugin in not open source, I don’t have access to the code.”
The shortcode below was created to display events on a page, and the order in which it is displayed is exactly what I need to show on the home page.
Shortcode:
[add_eventon_list number_of_months=”12″ event_count=”12″ show_limit=”yes” ux_val=”3″ event_past_future=”future” show_et_ft_img=”yes” eventtop_style=”5″ tiles=”yes” hide_mult_occur=”yes” hide_empty_months=”yes” show_year=”yes” hide_end_time=”yes” tile_count=”4″ tile_bg=”1″ tile_style=”2″]
Events Page Link: https://socialyte.com.br/agenda/
I managed to solve it!
Here is the solution code:
add_filter(‘nectar_post_grid_query’,’salient_child_mod_post_grid_query’);
function salient_child_mod_post_grid_query($query) {
// Checks if the post type is ‘ajde_events’
if(isset($query[‘post_type’]) && $query[‘post_type’] === ‘ajde_events’ ) {
$query[‘meta_key’] = ‘evcal_srow’; // Metadata key for sorting
$query[‘orderby’] = ‘meta_value’; // Sort by metadata value
}
return $query;
}
Hi Paulo,
Glad to hear that you managed to resolve the issue. Thanks for sharing the solution as well.
If you have any other questions, please feel free to create a new ticket.