コード例 #1
0
 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;
 }
コード例 #2
0
ファイル: Lib.php プロジェクト: dnielrodrigues/z-toolkit
 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;
 }