The Gallery Loop is section of code used by MediaPress to display a list of Galleries. MediaPress Gallery loop is modeled after the WordPress Post Loop. Any HTML or PHP code within the loop is repeated for each of the gallery.

The purpose of Gallery loop is to allow theme developers easily iterate through the collection of galleries. The Fetched galleries depend on the context of the current loop.

Simple MediaPress Gallery Loop:-

An Simple Gallery Loop will look like following:-

Inside the loop, you can use various template tags to generate the data.

List of Important template tags:-

  • mpp_gallery_id() :- Prints current gallery ID
  • mpp_gallery_title() :- Prints the current Gallery title
  • mpp_gallery_permalink() :- Prints the url of the current gallery
  • mpp_gallery_slug():- Print Current gallery slug.
  • mpp_gallery_description():- Prints current gallery description.
  • mpp_gallery_cover_src( $size ) :- Prints the src of the cover file. $size is one of the registered sizes( thumbnail, mid, full etc )
  • mpp_gallery_class( $custom_classes ):- Prints all the css classes that should be applied to the gallery. You can pass the custom classes optionally.
  • mpp_gallery_type() :- Print Current Gallery type ( photo, audio,video, doc etc )
  • mpp_gallery_status():- Prints current gallery status( private, public, friends, groups etc)
  • mpp_gallery_date_created() :- Prints the date this gallery was created
  • mpp_gallery_last_updated() :- Prints the date this gallery was last updated. Use time format from general settings.
  • mpp_gallery_creator_id():- Prints the Integer Id of the User who created this gallery.


Each of the above method has an equivalent getter function to return the value instead of printing. The naming convention is like mpp_get_function_name

Equivalent Getter functions:-

  • mpp_get_gallery_id()
  • mpp_get_gallery_title()
  • mpp_get_gallery_permalink()
  • mpp_get_gallery_slug()
  • mpp_get_gallery_description()
  • mpp_get_gallery_cover_src()
  • mpp_get_gallery_class()
  • mpp_get_gallery_type()
  • mpp_get_gallery_status()
  • mpp_get_gallery_date_created()
  • mpp_get_gallery_last_updated()
  • mpp_get_gallery_creator_id()

Please note, All the above functions can take the optional parameter of gallery to enable you use it outside the gallery loop.

Outside a gallery loop, you can use these functions by passing the gallery id or gallery object as the parameter.


Print the title of gallery whose Id is 3.

The options parameter can be:-

  • integer:- A valid gallery id¬†or
  • MPP_Gallery:- An instance of MPP_Gallery(Documentation for MPP_gallery will be available soon ).