I want to create a wp_query to list the post titles of posts from category X, in ascending order based on a custom field I inputted in each post called "eventdate".
I tried the following code but it didnt work. any idea how to fix? please advise. thanks in advance!
$loop = new WP_Query( array(
'showposts' => 5,
'post_type' => array('eventdate'),
'category_name' => X,
while ( $loop->have_posts() ) : $loop->the_post(); ?>
<h2><a href="<?php the_permalink() ?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
<?php endwhile; ?>