Support

Account

Home Forums Add-ons Repeater Field Echo Repeater-Field alphabetically query_posts Reply To: Echo Repeater-Field alphabetically query_posts

  • ok, now I got it.

    This is my solution if someone is interested:

    <?php
    // filter
    function my_posts_where( $where ) {
    	$where = str_replace("meta_key = 'artists_%", "meta_key LIKE 'artists_%", $where);
    	return $where;
    }
    
    add_filter('posts_where', 'my_posts_where');
    
    // find todays date
    $today = date('Ymd');
    
    $args = array(
    	'posts_per_page' => '-1',
    	'post_type' => 'veranstaltungen',
    	'orderby' => 'meta_value',
    	'meta_key' => 'artists_%_artistname',
    	'order'     => 'ASC',
       
    	'meta_query' => array(
    	'relation' => 'AND',
       		
    		array(
    			'key' => 'datum',
    			'value' => $today,
    			'compare' => '<',
            ),
            array(
    			'key' => 'artists_%_artistname',
            )
        )
    );
    
    query_posts( $args );
    ?>