Directory-Based Galleries for WordPress

DBG is a plugin for WordPress that aims to make it very simple to include galleries in your posts. Simply upload your pictures to a directory, add a tag in your post and voilà.

The plugin does not offer a web interface to uploading the pictures. You will need to use FTP or similar to upload the pictures.

Latest release: r417.

To install DBG

You need to do this only once.

  1. Download and unzip into your wp-content/plugins/ folder.
  2. Activate the plugin in your wp-admin control panel.
  3. Create two directories in your wp-content folder: one named galleries, the other named thumbnails.
  4. Make sure that the process that runs WordPress has write access to the wp-content/thumbnails/ directory, so it can automatically generate the thumbnails. If WordPress does not have write access, you will see PHP warning messages when you try to display a gallery in your post.

To create a gallery

Create a folder in wp-content/galleries/ and upload all pictures in the gallery to this folder. Do not use subdirectories. The folder name may consist of letters, numbers, dashes (-) and underscores (_).

To display a gallery in a post

Add the tag [DBG:gallery-name] in your post or page where you want the gallery included, replacing gallery-name by the exact name of the folder you put the pictures in. If your filesystem is case-sensitive, so is the gallery name. You can display the same gallery multiple times, if you wish.

To change the order of the pictures' appearance

In the folder that contains your gallery's images, create a file called index, listing the filenames of the pictures in the order you'd like to see them in the gallery, one filename per line. DBG will no longer automatically display all the pictures in the directory if it finds an index file. This way, you can prevent certain pictures from being shown, or even display pictures several times, if you wish.

To add captions

Create an index file as described in To change the order of the pictures' appearance. For each picture you'd like to add a caption to, append a colon (:), followed by the desired caption.


DBG is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 2.5 license. For other uses, please contact me.