我需要根据带有特定键的两个自定义字段选择要显示的帖子,并按第三个字段排序。这是我的产品,但订购不正确。
<?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;
?>