diff --git a/zoninator.php b/zoninator.php index 7a2387f..ab1a563 100644 --- a/zoninator.php +++ b/zoninator.php @@ -1086,27 +1086,24 @@ function get_single_post_in_zone( $zone, $args = array() ) { } function get_zones_for_post( $post_id ) { - // TODO: build this out - // get_object_terms - // get_terms - - // OR - - // get all meta_keys that match the prefix - // strip the prefix + $post_zones = array(); - // OR + foreach($this->get_zones() as $zone) { - // get all zones and see if there's a matching meta entry - // strip the prefix from keys + foreach($this->get_zone_posts($zone) as $post) { + + if($this->get_post_id($post) == $post_id) { + $post_zones[] = $zone; + break; + + } + + } + + } - // array_map( 'absint', $zone_ids ) - // $zones = array(); - // foreach( $zone_ids as $zone_id ) { - // $zones[] = get_zone( $zone_id ); - //} - //return $zones; + return $post_zones; } function get_zones( $args = array() ) {