• Resolved wcmaster

    (@wcmaster)


    I have a site about a 5-day event that occurs on a yearly basis. Your plugin would be idea to display each day’s events on a timeline. Currently, I am testing your plugin with added custom fields for date and time (https://www.wp-timelineexpress.com/documentation/enable-announcement-dates-times/). But, an issue has come up that I have yet figured out.

    The website has quite a few events that have the same start date and time. Problem is I would like to order these events in a specific way. Is there a way to do this? Like sorting by publishing date. Or add another custom field, called “sort-order”.

    Also, is there a way to tell the plugin to sort the announcements by multiple fields — announcement-date, announcement-time, announcement-end-time, published-date?

    Thanks in advance!

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Contributor Code Parrots

    (@codeparrots)

    Hi @wcmaster,

    Let me take a look and see what we can come up with as a solution for times when events have the same date/time.

    I will post back here after we’ve done some testing.

    Thread Starter wcmaster

    (@wcmaster)

    Many thanks. Look forward to what you and your team come up with.

    FYI, I added the following custom fields to the plugin:

    1) announcement-location
    2) announcement-time
    3) announcement-end-time

    Cheers!

    Plugin Contributor Code Parrots

    (@codeparrots)

    Hi @wcmaster,

    Can you try using the following filter to see if you this works for you:

    function timeline_express_fallback_to_published_dates( $args, $post, $atts ) {
    
    	$args['orderby'] = [
    		'meta_value_num' => $args['order'],
    		'date'           => $args['order']
    	];
    
    	return $args;
    
    }
    add_filter( 'timeline_express_announcement_query_args', 'timeline_express_fallback_to_published_dates', 10, 3 );

    That should order the announcements based on the announcement date, and if the dates are the same, fallback to the post published date (set above the ‘Publish’ button on the post edit page).

    You can add that to your themes functions.php file, or create an MU plugin or custom plugin to add it to.

    Thread Starter wcmaster

    (@wcmaster)

    Awesome! That worked out great. I look forward buying the pro version and creating multiple timelines for each day. Thanks for the great plugin.

    Plugin Contributor Code Parrots

    (@codeparrots)

    Great! We are working on getting the date-time addon built out as an addon so all of this doesn’t require coding. The existing code snippet will also be updated to reflect the fallback to the published dated. The code snippet hosted in the docs will also continue to work, and the addon will be for those who don’t know and or want to write any code.

    Thanks again! Have a great rest of your week.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Custom Sort Order’ is closed to new replies.