From e3aa88a4c376a831e83e68a74e8767f88e2f5080 Mon Sep 17 00:00:00 2001 From: Sean Michaels Date: Sat, 4 Jan 2014 15:24:03 -0500 Subject: [PATCH] implemented get_zones_for_post --- zoninator.php | 31 ++++++++++++++----------------- 1 file changed, 14 insertions(+), 17 deletions(-) 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() ) {