Support

Account

Home Forums General Issues sort custom posts by time from repeater Reply To: sort custom posts by time from repeater

  • thanks for fast reply… is it possible to sort my custom post type with the date-time-picker?

    for example… to get all Courses from monday i use the following… but it is not sorted by time…

    <?php 
     
    // args
    $args = array(
    	'post_type'		=> 'kurse',
    	'posts_per_page'	=> -1,
    
    	'meta_query' => array(
    		array(
    	'meta_key'		=> 'von',
    	'orderby'		=> 'meta_value_num',
    	'order'			=> 'ASC'
    		)
    	)
    
    );
     
    // query
    $wp_query = new WP_Query( $args );
     
    // loop
    while( $wp_query->have_posts() )
    {
    	$wp_query->the_post(); ?>
     
    
    <?php $tag_wahl = get_field('tag'); if($tag_wahl == 'Montag'): ?>
    <?php the_title(); ?><br>
    <?php if(get_field('zeit')): ?>
    <?php while(the_repeater_field('zeit')): ?><?php the_field('tag'); ?>´s von <?php the_sub_field('von'); ?> Uhr bis <?php the_sub_field('bis'); ?> Uhr.
    <?php endwhile; ?><br><br>
    <?php endif; ?>
    <?php endif; ?>
    
    <?php }
     
    ?>