| | |
| | | $postID = wp_get_post_parent_id($attachmentId); |
| | | if ($postID && !in_array($postID, $postsAttachedTo)){ |
| | | $postsAttachedTo[] = $postID; |
| | | //TODO: is there a better way? |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | foreach($childPosts as $i => $imgID) { |
| | | $treatment = $i + 1; |
| | | $child = $this->createTimelinePoint($imgID, $parent, $args['user'], $args['post_type'], $title, $treatment); |
| | | $child = $this->createTimelinePoint($imgID, $parent, $args['post_author'], $args['post_type'], $title, $treatment); |
| | | if ($child && !is_wp_error($child) && $child> 0 ) { |
| | | $createdChildren[] = $child; |
| | | $usedUploads[] = $imgID; |
| | |
| | | private function updateTimelineMetadata(int $parentId): void |
| | | { |
| | | // Get all child posts |
| | | $children = get_children([ |
| | | 'post_parent' => $parentId, |
| | | 'post_type' => get_post_type($parentId), |
| | | 'post_status' => ['publish', 'draft'], |
| | | 'orderby' => 'date', |
| | | 'order' => 'DESC', |
| | | 'fields' => 'ids' |
| | | ]); |
| | | $children = jvbTimelinePoints($parentId, get_post_type($parentId), ['any']); |
| | | |
| | | // Count includes parent + children |
| | | $number = count($children) + 1; |