Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • #12655

    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: is a good starting point.


    this works:

    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);


    Glad it works! Let us know if you have more questions.



Viewing 4 posts - 1 through 4 (of 4 total)

The topic ‘CPT order the loop by meta date’ is closed to new replies.