• Hello

    Can anyone advise me on the best way to use WordPress as a gallery?

    I’m looking to have a website similar to https://www.freethemelayouts.com/ in that the index page has a series of thumbnails.

    Is it a case of arranging the xhtml inside the while loop so that it looks that way and then each post is just a thumbnail graphic or is there a plugin specifically to achieve the result as with freethemelayouts.com

    thanks

Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator James Huff

    (@macmanx)

    You can use WordPress’ native galleries.

    Create or edit the page and then click the “Add an image” button (it looks like a tiny picture and it’s first from the left next to “Upload/Insert” above the post edit area. You can use this to upload the picture and WordPress will automatically generate the various sizes (including thumbnails). Now, it’s important to note that once you add an image via this method while writing or editing a post/page, it will be “assigned” to the post/page. Once you have uploaded all of the desired pictures, click the “Add an image” button again and go to the “Gallery” tab. Set your desired settings and click the “Insert Gallery” button at the bottom to add the gallery to your page. This document describes the whole process in more detail:

    https://codex.www.ads-software.com/User:Esmi/The_WordPress_Gallery

    There are several ways to use WordPress as a gallery/showcase.

    You could use the inbuilt uploader to upload your image inside your post, or you could use custom fields (my preferred method).

    You then modify the loop on the index/categories to only display the content you want.

    Example you create a custom field called ‘Thumbnail’ you then create a loop that only shows the image of the custom field and the title of post from a defined category id:

    <!-- Start the Loop. -->
      <?php query_posts($query_string . '&cat=3'); ?>
      <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    
    <a href="<?php the_permalink(); ?>
    <img src="<?php echo get_post_meta($post->ID, 'Thumbnail', true); ?> alt="<?php echo the_title(); ?>" />
    </a>
    <a href="<?php the_permalink() ?>" title="<?php the_title(); ?>"><h3><?php the_title(); ?></h3></a>
    
     <!-- Stop The Loop (but note the "else:" - see next line). -->
     <?php endwhile; else: ?>
    
     <!-- The very first "if" tested to see if there were any Posts to -->
     <!-- display.  This "else" part tells what do if there weren't any. -->
     <p>Sorry, no posts matched your criteria.</p>
    
     <!-- REALLY stop The Loop. -->
     <?php endif; ?>

    You obviously also need to add your divs that tell it how to display into the loop above

    Thread Starter juanc

    (@juanc)

    Thank you very much for both of you replying.

    I’m guessing that perhaps the preferred solution in my case would be the one mentioned by threestyleer as the native gallery is only to have a gallery on one page whereas in my case I need to have pagination……..so essentially the thumbnails are the posts.

    What do people think?

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How do you use WordPress as a gallery?’ is closed to new replies.