the_permalink(); ?> "> <img class="mail_icon" src="<?php bloginfo('template_url'); ?> /images/mail_send.png" /> Share this page </a> <div class="description"> <?php the_content(); ?> </div> <?php $downloads = _get_attachments($post_id, $mimetype = null, $not_mimetype = array('image', 'video', 'audio')); if (count($downloads)) { ?> <h3 class="download_label">Downloads:</h3> <ul class="attachments attachments-downloads"> <?php is_listDownloads(); ?> </ul> <?php } ?> </div>
function _append_child_attachments($attachments = array()) { // it would be good if this handled a multidimensional array being passed in // as we would get a speed up by doing _get_attachments and the insert once $parent_ids = array(); foreach ($attachments as $a) { array_push($parent_ids, $a->ID); } // here are the attachments $child_results = _get_attachments(implode(',', $parent_ids)); // $child_results = _update_image_paths($child_results); // walk the arrays looking for the parents // child is passed by reference allowing it to be updated - DOES THIS WORK IN PHP4 ? foreach ($child_results as &$child) { foreach ($attachments as &$a) { // which parent ($a) is this child for ? if ($child->parent == $a->ID) { if (is_array($a->children)) { array_push($a->children, $child); } else { $a->children = array($child); } // insert each child in as its role's as well if ($child->meta['roles']) { foreach ($child->meta['roles'] as $role => $value) { if ($value) { $a->{$role} = $child; } } // pop posters in where images are missing if ($child->meta['roles']['poster']) { if (is_array($child->meta['sizes'])) { foreach ($child->meta['sizes'] as $size => $src) { if (!$a->meta['sizes'][$size]) { /* from wp core - ./wp-includes/media.php:126:function image_downsize($id, $size = 'medium') { list( $img_src, $width, $height ) = image_downsize($id, $size); */ // $a->$size = wp_get_attachment_url($child->ID); list($img_src, $width, $height) = image_downsize($child->ID, $size); $a->{$size} = $img_src; $a->meta['sizes'][$size] = $a->{$size}; } } } } } break; } } } // print_r($attachments); return $attachments; }