Support » Plugin: Custom Fields Creator » How to Query Meta Key value ?

  • Let me explain with a simple example first :
    I have created Custom Post Type named “events”
    In that I have create a Meta Box named “moredetails”
    And in that meta box, I have added 2 custom fields
    1. event-type (radio buttons with value as “Upcoming Events” and “Past Events” )
    2. event-picture (single file upload)

    Now what would like to do is, I want to create archive page(listing page) where all events will be listed under 2 sections left-right side.
    Left side : Upcoming Events (here all events having event-type = “Upcoming Events” value will be listed)
    Right side : Past Events (here all events having event-type = “Past Events” value will be listed)

    I would like to know how to Query these meta keys and compare the values?

    Below is what I have done so far, but I that is not working :

    $args = array(
                        'posts_per_page' => 100,
                        'post_type' => 'events',
                        'orderby' => 'ID',
                        'order' => 'DESC',
                        'meta_key' => 'event-type',
                        'meta_value' => 'Upcoming Event'
                    );
                    query_posts($args);

    http://wordpress.org/extend/plugins/custom-fields-creator/

  • The topic ‘How to Query Meta Key value ?’ is closed to new replies.