i am using the easy content types plugin on a childthemed coherence site. i have an archive template with “get_template_part( ‘includes/loop’, ‘termine’ );”
i’ve created a copy /wp-content/themes/coherence/includes/loop-index.php valled loop-termine.php to show my cpt and pull my meta fields. i have a custom date as timestamp.
is there an easy way to change the order of the loop to that date?
like passing an “orderby” => “ecpt_date”.
You can use orderby => “date” if it’s a standard date. Otherwise, if it’s a meta value, it’s not possible out of the box and requires some custom code. I think this thread: http://wordpress.stackexchange.com/questions/15839/wordpress-how-to-sort-by-meta-value is a good starting point.
global $avia_config, $post_loop_count, $wp_query;
$meta_sorting = array(
‘meta_key’ => ‘ecpt_datum’,
‘orderby’ => ‘meta_value_num’,
‘order’ => ‘ASC’
$avia_config = array_merge($wp_query->query, $meta_sorting);
The topic ‘CPT order the loop by meta date’ is closed to new replies.