I wonder if anyone might be able to help me out:)
I have a custom post type called events and I would like to display the 3 latest events with the custom field “featured” set to “Ja” (Dutch equivalent of Yes).
So far I’ve got my widget set up like this:
<?php $loop = new WP_Query( array( 'post_type' => 'Event')); ?> <?php while ( $loop->have_posts() ) : $loop->the_post(); ?> <?php the_title( '<h4 class="entry-title"><a href="' . get_permalink() . '" title="' . the_title_attribute( 'echo=0' ) . '" rel="bookmark">', '</a></h4>' ); ?> <div class="entry-content"> <?php the_content(); ?> </div> <?php endwhile; ?>
This does the trick, but does not filter by the featured custom value. I’ve been looking in the function reference for a clear example, but could not find one. Any help would be greatly appreciated. 🙂
- The topic ‘WP_Query and custom_field sorting question’ is closed to new replies.