How to display custom post type ordered by a custom field date
I have a custom post type for a timeline activities.
each post of them has a custom field type of DATE. field name :
I’m using TYPES plugin for Custom Post Type and Custom Fields
I would like to order these posts by the custom date field, I tried the following but didn’t work.
<?php $activities = new WP_Query( array( 'post_type' => 'timeline', 'posts_per_page' => -1, 'key' => 'activity-date', 'orderby' => 'meta_value_num', 'order' => 'ASC' )); ?>