Get post-meta value of all custom-posts – lowest to highest year-count?
something like this should do the job: global $post; $years = array(); $loop = new WP_Query( $args ); while ( $loop->have_posts() ) : $loop->the_post(); $this_year = get_post_meta( $post->ID, ‘event_date’, true ); if ( $this_year = date( ‘Y’, $this_year ) ) { if ( ! in_array( $this_year, $years ) ) { $years[] = $this_year; } } … Read more