If trying to filter out some return results from a custom post type that has a custom field appended to it for location. I'm not too sure where I need to apply the case statement in my query. Or if I need to add it into the query when it pulls the info from the post type.

I currently have this:

```
<?php
$mypost = array('post_type' => 'staff', 'posts_per_page' => 20 );
$loop = new WP_Query( $mypost );
 ?>
<ul>

<?php while ( $loop->have_posts() ) : $loop->the_post();?>

<?php $items = get_post_meta( $post->ID, 'elements', true ); 
foreach( $items as $i){
if($i['location'] = 'local') {
echo'<li>
    <a href=" '. get_permalink() .' ">
    <img src=" '. wp_get_attachment_url( $i['small-image'] ) .'" />
    <h4>' . $i['staff-name'] . '</h4>
    <p>' . $i['short-title'] . '</p>
    ' . $i['3-areas-of-focus'] . '
    </li></a>

    ';
    }
}
?>  

<?php endwhile; wp_reset_query(); ?>
<div class="clearfix"></div>

</ul>

```

I have the custom field for the location as a checkbox, so inside the custom post type it shows:

```
local, out of town

```

The thing is that some staff members can have a location local and out of town, but some are just local.

So, I'm not sure if I need to have do a trim explode before or if there is some other way that I need to have it look up in the query or what.