public static function getTheAttachments($slug) { $args = array('post_type' => 'attachment', 'posts_per_page' => -1); $itens = get_posts($args); foreach ($itens as $item) { $parentId = $item->post_parent; if ($parentId != 0) { $parentSlug = Lib::getSlug($parentId); if ($parentSlug == $slug) { $attachments[] = $item; } } } return $attachments; }
public static function getTheAttachments($slug) { $args = array('post_type' => 'attachment', 'posts_per_page' => -1); $pages = get_posts($args); foreach ($pages as $page) { $parentId = $page->post_parent; if ($parentId != 0) { $parentSlug = Lib::getSlug($parentId); if ($parentSlug == $slug) { $childPages[] = $page; } } } return $childPages; }