/** Sets up the Set instance */ public function setUp() { $childPosts = get_posts(array('post_type' => SetCpt::CPT_SLUG, 'post_parent' => $this->getId())); foreach ($childPosts as $post) { if (self::postMatchesCriteria($post)) { $this->id = $post->ID; $this->post = $post; break; } } /** Action: op_set_before_setup */ do_action(self::WP_ACTION_BEFORE_SETUP, $this); $persistence = new Persistence($this->post); $this->periods = ArrayObject::createFromArray($persistence->loadPeriods()); $this->holidays = ArrayObject::createFromArray($persistence->loadHolidays()); $this->irregularOpenings = ArrayObject::createFromArray($persistence->loadIrregularOpenings()); $post_detail_description = get_post_detail('description', $this->id); $post_parent_detail_description = get_post_detail('description', $this->parentId); if (!empty($post_detail_description)) { $this->description = $post_detail_description; } elseif (!empty($post_parent_detail_description)) { $this->description = $post_parent_detail_description; } }