WordPress.org

Ready to get started?Download WordPress

Forums

show attachtment ID, and next attachtment ID (1 post)

  1. thirsty.bunny
    Member
    Posted 1 year ago #

    Hello dear,
    this is my page query, to call all attachtment pictures in a page.
    i need to count my images by numbers,
    so each attachment, will got a unique number

    <?php while ( have_posts() ) : the_post(); ?>
    <?php
    	$thumb_ID = get_post_thumbnail_id( $post->ID );
    	if ( $images = get_children(array(
    			'post_parent' => get_the_ID(),
    			'post_type' => 'attachment',
    			'post_mime_type' => 'image',
    			'exclude' => $thumb_ID,
    		))) : ?>
    		<?php foreach($images as $image) {
    $attachment=wp_get_attachment_image_src($image->ID, $size);  ?>
    			<li style="list-style:none; width: 180px; height: 230px;float:left;margin-right:10px; background-color:#FFF;">
                <a href="#image-<strong>i</strong>"><img src="<?php bloginfo('template_directory'); ?>/includes/timthumb.php?src=<?php echo $attachment[0]; ?>&h=230&w=180&a=t&zc=1" />
    <div class="lb-overlay" id="image-<strong>1</strong>"></a>
    							<img src="images/full/1.jpg" alt="image01" />
    							<div>
    								<a href="#image-Latest-Image" class="lb-prev">Prev</a>
    								<a href="#image-i+1" class="lb-next">Next</a>
    							</div>
    							<a href="#page" class="lb-close">x Close</a>
    						</div>
                </li>
    		<?php } ?>
    <?php else: // No images ?>
    	<!-- This post has no attached images -->
    <?php endif; ?>
    <?php endwhile; // end of the loop. ?>

    also , i want to determine the next image, and latest image
    Prev
    Next

    thanks so much

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.