Posted: October 29, 2014 at 4:19 am
|
Hi Folks, running the latest version of EE 4.4.3.p on WordPress 4.0. I would like to provide the option to manually sort the events on the event archive for a site. Have you got a recommended suggestion for doing this? |
Hi Kyle, The closest option to this would be to cluster events within a category. Then several of these category shortcodes could be added to a WordPress page: [ESPRESSO_EVENTS category_slug=”featured-events-1″] — |
|
|
Hi Lorenzo, thanks for the response. The problem I have with the shortcodes (and the main reason I am sticking with archives for the site) is that I can’t see how to modify the design and layout of the events in a shortcode. I have modified the archive to display each event within an accordian, I wouldn’t know how to make a shortcode do this. Any suggestions? Thank you. |
|
You could create a custom query instead and add it to a page template – here’s an example query https://gist.github.com/joshfeck/e3c9540cd4ccc734e755 |
|
Hi Dean, thank you very much for your previous advice and I have done exactly what you said. I used that custom query to generate the list of events on my event archive. It works a treat…until I try to introduce a meta_key and try to sort by that. It simply displays this as normal. Here is my slightly modified query: $atts = array( global $wp_query; if (have_posts()) : while (have_posts()) : the_post(); Is there something wrong with using meta values for sorting in this way? Cheers folks |
Hello Kyle, I’m not sure ‘meta_value_num’ is available in this query. |
|
Hi there, Yeah, the the meta value gets filtered out. You can use the post_orderby filter instead. Here’s a good answer from stackexchange that may help: |
|
|
Thank you Josh. I got that working mostly. I am still working out how to make that work with a numerical field – the example works with meta_value which sorts alphabetically and replacing meta_value_num in this code doesn’t seem to work. Unfortunately this leads to values of 1, 11, 111 appearing before 2 and 22 etc. I got around this by starting the numbering at 10 or 100. Just thought that information might be useful to other members if they come across this same situation. |
Hi Kyle, Here’s another related Stackexchange thread that may help. http://wordpress.stackexchange.com/questions/13129/wordpress-orderby-numeric-value-not-working |
|
The support post ‘Custom Order of events on archive’ 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.