function is_listAttachments($post_id = null, $mimetype = 'image', $attachments = null) { if (!is_array($attachments)) { $attachments = is_getAttachments($post_id, $mimetype); } // print "<!-- $mimetype attachments list -->"; $i = 0; foreach ($attachments as $a) { $mime_type = str_replace('/', '-', $a->mime_type); $alt_title = htmlspecialchars(strip_tags($a->title), ENT_QUOTES); $description = apply_filters("post_content", $a->description); if ($a->meta['sizes']['large']) { $large = $a->meta['sizes']['large']; } else { $large = $a->meta; } // $rel = $large['width'] . 'x' . $large['height']; // $rel = json_encode($rel); if (!$a->large) { $a->large = $a->src; } if ($a->poster) { $rel = $a->poster->src; } else { $rel = "attachment-{$a->ID}"; } // print_r( $rel); echo "\n\t\t\t<li class='gallery-node item-{$i} parent-{$a->parent} type-{$mimetype} mimetype-{$mime_type}'>\n\t\t\t\t<a class='title' href='{$a->large}' title='{$alt_title}' rel='{$rel}'>\n\t\t\t\t\t{$a->title}\n\t\t\t\t</a>\n\t\t\t\t<span class='caption'>{$a->caption}</span>\n\t\t\t\t<span class='description'>{$description}</span>\n\t\t\t</li>\n\t\t\t"; $i++; } }
<!-- template gallery list --> <div class="gallery-container"> <div class="gallery"> <ul id="gallery-<?php the_ID(); ?> "> <?php $attachments = is_getAttachments(); is_drawImageGallery(); $total_attachments = count($attachments); // videos [youtube=http://www.youtube.com/watch?v=JaNH56Vpg-A] // shortcode processor foreach ($attachments['video'] as $v) { echo '<li class="gallery-node type-video">'; if (shortcode_exists('embed')) { global $wp_embed; $code = '[embed width="450" height="320"]' . $v->src . '[/embed]'; echo $wp_embed->run_shortcode($code); } else { echo $v->src; } echo '</li>'; } ?> </ul> </div> <div class="gallery-navigation"> <nav class="clearfix <?php if ($total_attachments < 2) { echo 'one-attachment';
?> <!-- Products --> <ol class="images"> <?php while (have_posts()) { the_post(); ?> <!--<div <?php post_class(); ?> >--> <?php if (!$post->attachments) { $post->attachments = is_getAttachments($post->ID); } if ($post->attachments['poster']) { $thumbimg = $post->attachments['poster']->thumbnail; $largeimg = $post->attachments['poster']->large; } else { if (count($post->attachments['images'])) { $thumbimg = $post->attachments['images'][0]->thumbnail; $largeimg = $post->attachments['images'][0]->large; } else { $thumbimg = get_bloginfo('stylesheet_directory') . "/images/blank.gif"; $largeimg = $post->attachments['poster']->large; } } $title = $post->attachments['poster']->title; ?>