/** * Provede inicializaci a načtení všech obrázků dle zadaného Post objektu a nastavení * * @author Tomáš Kocifaj * @link http://www.ktstudio.cz * * @return \KT_WP_Post_Gallery */ protected function initialize() { $queryArgs = array("post_type" => KT_WP_ATTACHMENT_KEY, "post_status" => "inherit", "posts_per_page" => $this->getNumberFiles(), "post_mime_type" => "image", "orderby" => $this->getOrderby(), "order" => $this->getOrder()); $customImageIds = $this->getCustomImageIds(); $isCustomImageIds = KT::arrayIssetAndNotEmpty($customImageIds); if ($this->getExcludeThumbnail()) { $thumbnailId = get_post_thumbnail_id($this->getPost()->ID); $queryArgs["post__not_in"] = array($thumbnailId); if ($isCustomImageIds) { $customImageIds = KT::arrayRemoveByValue($customImageIds, $thumbnailId); } } if ($isCustomImageIds) { $queryArgs["post__in"] = $customImageIds; } else { $queryArgs["post_parent"] = $this->getPost()->ID; } $images = new WP_Query($queryArgs); $this->setFiles($images->posts); return $this; }
/** * Odebere (zadaný) název šablony stránky * Pozn.: tuto funkci je vhodné používat pouze pro metaboxy registrované stránkám, které mají právě zadanou šablonu (template) * * @author Martin Hlaváč * @link http://www.ktstudio.cz * * @param string $pageTemplate * @return \KT_MetaBox */ public function removePageTemplate($pageTemplate) { $this->pageTemplates = KT::arrayRemoveByValue($this->getPageTemplates(), $pageTemplate); return $this; }