Forum Replies Created

Viewing 1 replies (of 1 total)
  • Thread Starter otzined

    (@otzined)

    Hi Lester, I have put the code inside the loop.

    <?php if (have_posts()): ?>
                <?php while ( have_posts() ) : the_post(); ?>
    
            <?php
    $gallery = get_children( 'posts_per_page=-1post_type=attachment&post_mime_type=image&post_parent=' . $post->ID );
    $attr = array(
        'class' => "attachment-$size wp-post-image",
    );
    foreach( $gallery as $image ) {
         echo '<a href="' . wp_get_attachment_url($image->ID) . '" rel="gallery-' . get_the_ID() . '">';
         echo wp_get_attachment_image($image->ID, 'thumbnail', false, $attr);
         echo '</a>';
    }
    ?>
    
    			<?php endwhile; ?>
    <?php endif; ?>
Viewing 1 replies (of 1 total)