Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #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”.

    $avia_config…

    #76280

    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.

    #76281

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

    #76282

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

    Regards,

    Mya

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

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