Return to Snippet

Revision: 59769
at September 29, 2012 20:47 by shin


Updated Code
<?php
				$images = get_children(array('post_parent' => $post->ID, 'post_type' => 'attachment', 'post_mime_type' => 'image', 'orderby' => 'menu_order', 'order' => 'ASC', 'numberposts' => 1000, 'offset'=>1));
				if ( empty($images) ) {

				} else {
					echo '<ul class="descr-phot">';
					foreach ( $images as $attachment_id => $attachment ) {
					echo '<li>';
						$large_image_url = wp_get_attachment_image_src( $attachment_id, 'full'); 
						$thumb = wp_get_attachment_image_src( $attachment_id, 'descr');
						echo '<a href="' . $large_image_url[0] . '" class="thickbox">';
						echo '<img src="'. $thumb[0]. '" />';
						echo '</a>';
						echo '<span>'. $attachment->post_title .'</span>';
					echo '</li>';
					}
					echo '</ul>';
				}
				?>

Revision: 59768
at September 28, 2012 20:59 by shin


Initial Code
<?php
				$images = get_children(array('post_parent' => $post->ID, 'post_type' => 'attachment', 'post_mime_type' => 'image', 'orderby' => 'menu_order', 'order' => 'ASC', 'numberposts' => 1000, 'offset'=>1));
				if ( empty($images) ) {

				} else {
					echo '<ul class="descr-phot">';
					foreach ( $images as $attachment_id => $attachment ) {
					echo '<li>';
						$large_image_url = wp_get_attachment_image_src( $attachment_id, 'full'); 
						echo '<a href="' . $large_image_url[0] . '">';
						echo wp_get_attachment_link($attachment_id, 'descr');
						echo '</a>';
						echo '<span>'. $attachment->post_title .'</span>';
					echo '</li>';
					}
					echo '</ul>';
				}
				?>

Initial URL


Initial Description
description from title, image size from function.php (add_image_size( 'descr', 278, 200, true );)

Initial Title
show attachment images (except for the first image) with description (user thumbnail size)

Initial Tags
wordpress, images

Initial Language
PHP