0

Lets assume I have two following directories fruits and vegetables under my image folder and that I want to show all images on some specific page.

My questions are following:

  1. How to implement PHP script that will show all images from specific folder?
  2. How can I implement to pull thumbnail and big image from same folder, and show them like in photobox mode, ie. once clicked on a thumbnail image, you get to big screen?

I have tried modifying following

<div id="partner">
        <?php 
            $temp = $wp_query; 
            $wp_query = null; 
            $wp_query = new WP_Query(); 
            $wp_query->query('showposts=-1&post_type=gallery'.'&paged='.$paged); 
            while ($wp_query->have_posts()) : $wp_query->the_post(); 
        ?>
        <!-- LOOP: Usual Post Template Stuff Here-->
            <div class="part_img_class col-lg-2 col-md-4 col-sm-4 col-xs-12">
                <a rel="tooltip" title="<?php the_content();?>" href="
                        <?php $saved_post_id = $post->ID; ?>
                        <?php echo wp_get_attachment_url( get_post_thumbnail_id( $saved_post_id ) ); ?>

            ">
            <?php the_post_thumbnail('homepage-thumb');?>
            </a>
            </div>
        <!-- LOOP: Usual Post Template Stuff Here-->
        <?php endwhile; ?>

        <?php 
            $wp_query = null; 
            $wp_query = $temp;  // Reset
        ?>

    </div>

1 Answer 1

0

why not to use a plugin like nextgen-gallery? You can ask the plugin to scan a dir to build a gallery, then are many possibilities to display the images.

If this cannot be a solution you need to access via php directly the filesystem, not difficult but some work needed ;-)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.