WordPress Gallery code overview

Posted by

WordPress Gallery code overview:

As we all know, wordpress provides an inbuilt gallery feature, which can be used by inserting a gallery shortcode only. There are several option that you can customize this gallery.

You can use these options in following manner:

Lets have a look at these options:

1) columns

You can specify the number of columns to display. For example:

2) id:

specify the post ID. The gallery will display images which are attached to that post. The default behavior if no ID is specified is to display images attached to the current post.

3) size

specify the image size to use for the thumbnail display. Valid values include “thumbnail”, “medium”, “large” and “full”. The default is “thumbnail”.

For example:

4) Orderby

specify the sort order used to display thumbnails. The default is “menu_order ASC, ID ASC”.

5) itemtag

the name of the XHTML tag used to enclose each item in the gallery. The default is “dl”.

6) icontag

the name of the XHTML tag used to enclose each thumbnail icon in the gallery. The default is “dt”.

7) captiontag

the name of the XHTML tag used to enclose each caption. The default is “dd”. For example, to change the gallery markup to use div, span and p tags:

8.) link

you can set it to “file” so each image will link to the image file. The default value links to the attachment’s permalink.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.