Trying to learn about filtering custom fields
-
Hi,
I’m trying to learn how to filter custom posts on a custom field.
I have an events post type that I’m using for a list of gigs.
The event list will contain private posts for the bands eyes only.On the public facing gig list page I’m trying to filter by the ‘Gig Date’ (excluding all other types of the custom field ‘Type’ and also order them by the custom field ‘Date’.
This is what I’ve got so far…
$gigsPosts = new WP_Query(array( 'post_type' => 'events', 'meta_key' => 'type', 'meta_value' => 'gig date', 'posts_per_page' => 10, Array( 'meta_key' => 'date', 'orderby' => 'meta_value', 'order' => 'DESC' ) ) );
I’ve had varying results – none of them the right one!
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘Trying to learn about filtering custom fields’ is closed to new replies.