Select category in custom query

I would do this in two pieces.

  1. Add this into your functions.php file to grab custom fields globally:

    function get_custom_field($key, $echo = FALSE) {
    global $post;
    $custom_field = get_post_meta($post->ID, $key, true);
    if ($echo == FALSE) return $custom_field;
    echo $custom_field;
    

    }

  2. Build your query as follows:

I can’t seem to get markdown to play nice, so here’s the code in Pastie http://pastie.org/1294594

Leave a Comment