Hi Idet2,
After some quick testing, I’ve come up with the following bit of code that seems to be working well.
Go ahead and copy the following snippet directly into your active themes (ideally a child theme to prevent overrides on updates) functions.php :
/**
* Filter the Timeline Express query 'orderby' param & add a date fallback
*
* Timeline Express sorts by the announcement date by default.
* Use this function to fallback to the published date when two
* or more announcements are using the same announcement date.
* This allows for manual control over the order of announcements.
*
* Reference: https://www.ads-software.com/support/topic/order-same-date-timeline
* Source Code: https://github.com/EvanHerman/timeline-express/blob/master/lib/classes/class.timeline-express-initialize.php#L86
*/
function timeline_express_sort_by_published_date_fallback( $args, $post, $atts ) {
$args['orderby'] = $args['orderby'] . ' date';
return $args;
}
add_filter( 'timeline_express_announcement_query_args', 'timeline_express_sort_by_published_date_fallback', 10, 3 );
You’ll see that I’ve added a ‘date’ fallback to the orderby parameters. This means that when the initial query parameters are identical (eg: two announcements share the same announcement date), the date that the announcement was published on will be used.
This should be what you are after. Feel free to give things a testing and let me know how it works out. If successful, I will add it to our ‘to do’ list for future updates, so we can get this included in the core code as the default behavior.
Thanks!
Evan