I need to select posts to display based on two custom fields with a specific key and order them by a third. THis is what I have, but it is not ordering correctly.
<?php
$args = array(
'post_type' => 'event',
'order' => 'ASC',
'meta_query' => array(
'key' => 'Date Ordering Format',
'orderby' => 'meta_value',
'relation' => 'AND',
array(
'key' => 'Event Type',
'value' => '4. take-out tuesday',
'compare' => 'LIKE'
),
array(
'key' => 'Past Event',
'value' => 'Past',
'compare' => 'EXISTS'
)
)
);
$featured_query = new WP_Query($args);
if ($featured_query->have_posts()):
while ($featured_query->have_posts()):
$featured_query->the_post();
echo '<div class="fullWidthSeason">';
echo '<div class="pastEventImage">';
if (class_exists('MultiPostThumbnails')):
MultiPostThumbnails::the_post_thumbnail(get_post_type(), 'series-image', $post->ID, 'full', NULL, FALSE);
endif;
echo '</div>';
echo '<div class="featuredBlockDate ' . get_post_meta($post->ID, 'Event Text Left or Right', true) . ' ' . get_post_meta($post->ID, 'Black Text', true) . ' ' . get_post_meta($post->ID, 'Black Text', true) . '">';
echo 'Past Event: ';
echo get_post_meta($post->ID, 'Event Date', true);
echo '</div>';
echo '<div class="featuredBlockTitle ' . get_post_meta($post->ID, 'Event Text Left or Right', true) . ' ' . get_post_meta($post->ID, 'Black Text', true) . '">';
echo get_post_meta($post->ID, 'Season Page Title', true);
echo '</div>';
echo '<div class="featuredBlockExcerpt ' . get_post_meta($post->ID, 'Event Text Left or Right', true) . ' ' . get_post_meta($post->ID, 'Black Text', true) . '">';
echo the_excerpt();
echo '</div>';
echo '<div class="moreButton ' . get_post_meta($post->ID, 'Event Text Left or Right', true) . '">';
echo '<div class="moreButtonSeason ' . get_post_meta($post->ID, 'Event Text Left or Right', true) . '"><a href="' . get_post_meta($post->ID, 'Event RSVP Link', true) . '" target="_blank">' . get_post_meta($post->ID, 'Event RSVP Link Text', true) . '</a></div>';
echo '</div>';
echo '</div>';
endwhile;
wp_reset_query();
endif;
?>