Jump to content

Recommended Posts

  • Administrators

A while back I was asking for a simple Wordpress photo gallery. No one ended up providing a decent solution, so I decided to create something on my own.

 

I like the native Wordpress photo gallery, but it doesn't have anything to get you to the next picture after you click to enlarge a thumbnail, that's not very user friendly. I want people to actually view my photo gallery, if it's not convenient then people are not going to use it. I was using NexGen Gallery, but it's bloated and the pictures don't load as quickly as I would like. So here is a simple solution.

 

I read that with the native Wordpress gallery it searches to see if you have a image.php file present, if not it uses the Single.php file. I took a look at my theme and there is no Image.php file there. So I took my Single.php file and saved it as Image.php.

 

A couple minor changes to make to this Image.php file:

 

Find and remove:

<?php the_content(); ?>

 

Replace with:

<div style="float:right;"><?php next_image_link(false, 'Next Pic') ?></div><?php previous_image_link(false, 'Previous Pic') ?><br />
  <div style="text-align: center;"><a href="<?php echo wp_get_attachment_url($post->ID); ?>"><?php echo wp_get_attachment_image( $post->ID, 'large' ); ?></a></div>
  <?php if ( !empty($post->post_excerpt) ) the_excerpt(); ?><br />

 

That's it, save it off and upload into your theme directory. It makes it so simple, no if someone clicks a thumbnail in your gallery they can view that picture and also have links to view the next one or go back to previous without backing up to the gallery.

Link to post
Share on other sites

Ah yeah, maybe I could work on something like that, probably wouldn't be too hard now that I see how the system works.

 

Just realized you wanted a link to see it in action.

 

Native Wordpress Gallery Edit

 

Just tried your link. The pictures didn't load very fast on my browser. I mean I can see it showing bit by bit. Not at a snail's pace but still slow. Maybe it's my computer's fault. Is there any way to make those pictures pop up, so to say?

Link to post
Share on other sites

It's your computer or connection, fly's on both my desktops and laptops.

 

It reloads the whole page, though, which is probably why it's slower on his computer (and mine), especially with ads and stuff reloading as well. Probably best used on a no-ad or text-ad site, rather than one which could potentially load great big heavy Flash things.

 

Nice little tweak, there. Never used the WP gallery myself - I always use Coppermine for gallery sites and haven't mixed the two (though they do mix, apparently).

Link to post
Share on other sites
  • 3 weeks later...
  • Administrators

It reloads the whole page, though, which is probably why it's slower on his computer (and mine), especially with ads and stuff reloading as well. Probably best used on a no-ad or text-ad site, rather than one which could potentially load great big heavy Flash things.

 

Nice little tweak, there. Never used the WP gallery myself - I always use Coppermine for gallery sites and haven't mixed the two (though they do mix, apparently).

 

Yeah good call, maybe I should continue a little further with this so the entire page doesn't reload only the pictures.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...