{"id":77,"date":"2015-04-30T16:40:51","date_gmt":"2015-04-30T16:40:51","guid":{"rendered":"http:\/\/buddydev.com\/mediapress\/?p=77"},"modified":"2015-04-30T16:44:27","modified_gmt":"2015-04-30T16:44:27","slug":"the-gallery-loop","status":"publish","type":"post","link":"https:\/\/buddydev.com\/mediapress\/api-guides\/the-gallery-loop\/","title":{"rendered":"The Gallery Loop"},"content":{"rendered":"<p><strong>The Gallery Loop<\/strong> is section of code used by MediaPress to display a list of Galleries. MediaPress Gallery loop is modeled after the <a title=\"WordPress Post Loop\" href=\"https:\/\/codex.wordpress.org\/The_Loop\">WordPress Post Loop<\/a>. Any HTML or PHP code within the loop is repeated for each of the gallery.<\/p>\n<p>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.<\/p>\n<h3>Simple MediaPress Gallery Loop:-<\/h3>\n<p>An Simple Gallery\u00a0Loop will look like following:-<\/p>\n<pre class=\"lang:default decode:true\">&lt;?php while( mpp_have_galleries() ): mpp_the_gallery(); ?&gt;\r\n\r\n\t&lt;div class=\"&lt;?php mpp_gallery_class();?&gt;\" id=\"mpp-gallery-&lt;?php mpp_gallery_id();?&gt;\"&gt;\r\n\r\n\r\n\r\n\t\t&lt;div class=\"mpp-item-entry mpp-gallery-entry\"&gt;\r\n\t\t\t&lt;a href=\"&lt;?php mpp_gallery_permalink() ;?&gt;\" class=\"mpp-item-thumbnail mpp-gallery-cover\"&gt;\r\n\t\t\t\t&lt;img src=\"&lt;?php mpp_gallery_cover_src( 'thumbnail' ) ;?&gt;\" \/&gt;\r\n\t\t\t&lt;\/a&gt;\r\n\t\t&lt;\/div&gt;\t\r\n\r\n\t\t&lt;?php do_action( 'mpp_before_gallery_title' ); ?&gt;\r\n\r\n\t\t&lt;a href=\"&lt;?php mpp_gallery_permalink() ;?&gt;\" class=\"mpp-gallery-title\"&gt;&lt;?php mpp_gallery_title() ;?&gt;&lt;\/a&gt;\r\n\r\n\r\n\t&lt;\/div&gt;\r\n\r\n&lt;?php endwhile; ?&gt;<\/pre>\n<p>Inside the loop, you can use various template tags to generate the data.<\/p>\n<h3>List of Important template tags:-<\/h3>\n<ul>\n<li><strong>mpp_gallery_id()<\/strong> :- Prints current gallery ID<\/li>\n<li><strong>mpp_gallery_title()<\/strong> :- Prints the current Gallery title<\/li>\n<li><strong>mpp_gallery_permalink()<\/strong> :- Prints the url of the current gallery<\/li>\n<li><strong>mpp_gallery_slug()<\/strong>:- Print Current gallery slug.<\/li>\n<li><strong>mpp_gallery_description()<\/strong>:- Prints current gallery description.<\/li>\n<li><strong>mpp_gallery_cover_src( $size )<\/strong> :- Prints the src of the cover file. $size is one of the registered sizes( thumbnail, mid, full etc )<\/li>\n<li><strong>mpp_gallery_class( $custom_classes )<\/strong>:- Prints all the css classes that should be applied to the gallery. You can pass the custom classes optionally.<\/li>\n<li><strong>mpp_gallery_type()<\/strong> :- Print Current Gallery type ( photo, audio,video, doc etc )<\/li>\n<li><strong>mpp_gallery_status()<\/strong>:- Prints current gallery status( private, public, friends, groups etc)<\/li>\n<li><strong>mpp_gallery_date_created()<\/strong> :- Prints the date this gallery was created<\/li>\n<li><strong>mpp_gallery_last_updated()<\/strong> :- Prints the date this gallery was last updated. Use time format from general settings.<\/li>\n<li><strong>mpp_gallery_creator_id()<\/strong>:- Prints the Integer Id of the User who created this gallery.<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<div class='ui-sc ui-info-message'><p>Each of the above method has an equivalent getter function to return the value instead of printing. The naming convention is like <strong>mpp_get_<\/strong>function_name<\/p><\/div>\n<h3>Equivalent Getter functions:-<\/h3>\n<ul>\n<li>mpp_get_gallery_id()<\/li>\n<li>mpp_get_gallery_title()<\/li>\n<li>mpp_get_gallery_permalink()<\/li>\n<li>mpp_get_gallery_slug()<\/li>\n<li>mpp_get_gallery_description()<\/li>\n<li>mpp_get_gallery_cover_src()<\/li>\n<li>mpp_get_gallery_class()<\/li>\n<li>mpp_get_gallery_type()<\/li>\n<li>mpp_get_gallery_status()<\/li>\n<li>mpp_get_gallery_date_created()<\/li>\n<li>mpp_get_gallery_last_updated()<\/li>\n<li>mpp_get_gallery_creator_id()<\/li>\n<\/ul>\n<div class='ui-sc ui-info-message'><p>Please note, All the above functions can take the optional parameter of gallery to enable you use it outside the gallery loop.<\/p><\/div>\n<p>Outside a gallery loop, you can use these functions by passing the gallery id or gallery object as the parameter.<\/p>\n<h3>Example:-<\/h3>\n<p>Print the title of gallery whose Id is 3.<\/p>\n<pre class=\"lang:default decode:true \">&lt;?php echo mpp_get_gallery_title( 3 ); ?&gt;<\/pre>\n<p>The options parameter can be:-<\/p>\n<ul>\n<li><strong>integer<\/strong>:- A valid gallery id\u00a0<strong>or<\/strong><\/li>\n<li><strong>MPP_Gallery<\/strong>:- An instance of MPP_Gallery(Documentation for MPP_gallery will be available soon ).<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>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 &#8230;<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7044],"tags":[],"class_list":["clearfix","post-77","post","type-post","status-publish","format-standard","hentry","category-api-guides"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v25.9 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>The Gallery Loop &#8226; MediaPress | BuddyDev<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/buddydev.com\/mediapress\/api-guides\/the-gallery-loop\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"The Gallery Loop &#8226; MediaPress | BuddyDev\" \/>\n<meta property=\"og:description\" content=\"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 ...\" \/>\n<meta property=\"og:url\" content=\"https:\/\/buddydev.com\/mediapress\/api-guides\/the-gallery-loop\/\" \/>\n<meta property=\"og:site_name\" content=\"MediaPress | BuddyDev\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/bpdev\" \/>\n<meta property=\"article:published_time\" content=\"2015-04-30T16:40:51+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2015-04-30T16:44:27+00:00\" \/>\n<meta name=\"author\" content=\"Brajesh Singh\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@sbrajesh\" \/>\n<meta name=\"twitter:site\" content=\"@buddydev\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Brajesh Singh\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/buddydev.com\/mediapress\/api-guides\/the-gallery-loop\/\",\"url\":\"https:\/\/buddydev.com\/mediapress\/api-guides\/the-gallery-loop\/\",\"name\":\"The Gallery Loop &#8226; MediaPress | BuddyDev\",\"isPartOf\":{\"@id\":\"https:\/\/buddydev.com\/mediapress\/#website\"},\"datePublished\":\"2015-04-30T16:40:51+00:00\",\"dateModified\":\"2015-04-30T16:44:27+00:00\",\"author\":{\"@id\":\"https:\/\/buddydev.com\/mediapress\/#\/schema\/person\/4ebf5f3e519f8cbddc6583e182dbe4fb\"},\"breadcrumb\":{\"@id\":\"https:\/\/buddydev.com\/mediapress\/api-guides\/the-gallery-loop\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/buddydev.com\/mediapress\/api-guides\/the-gallery-loop\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/buddydev.com\/mediapress\/api-guides\/the-gallery-loop\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/buddydev.com\/mediapress\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"The Gallery Loop\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/buddydev.com\/mediapress\/#website\",\"url\":\"https:\/\/buddydev.com\/mediapress\/\",\"name\":\"MediaPress | BuddyDev\",\"description\":\"The Best Media Gallery Plugin For BuddyPress\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/buddydev.com\/mediapress\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/buddydev.com\/mediapress\/#\/schema\/person\/4ebf5f3e519f8cbddc6583e182dbe4fb\",\"name\":\"Brajesh Singh\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/buddydev.com\/mediapress\/#\/schema\/person\/image\/\",\"url\":\"\/\/www.gravatar.com\/avatar\/2106622ee90d53d15ac1402806616aca?s=96&#038;r=g&#038;d=identicon\",\"contentUrl\":\"\/\/www.gravatar.com\/avatar\/2106622ee90d53d15ac1402806616aca?s=96&#038;r=g&#038;d=identicon\",\"caption\":\"Brajesh Singh\"},\"sameAs\":[\"http:\/\/buddydev.com\/members\/sbrajesh\/\",\"https:\/\/x.com\/sbrajesh\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"The Gallery Loop &#8226; MediaPress | BuddyDev","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/buddydev.com\/mediapress\/api-guides\/the-gallery-loop\/","og_locale":"en_US","og_type":"article","og_title":"The Gallery Loop &#8226; MediaPress | BuddyDev","og_description":"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 ...","og_url":"https:\/\/buddydev.com\/mediapress\/api-guides\/the-gallery-loop\/","og_site_name":"MediaPress | BuddyDev","article_publisher":"https:\/\/www.facebook.com\/bpdev","article_published_time":"2015-04-30T16:40:51+00:00","article_modified_time":"2015-04-30T16:44:27+00:00","author":"Brajesh Singh","twitter_card":"summary_large_image","twitter_creator":"@sbrajesh","twitter_site":"@buddydev","twitter_misc":{"Written by":"Brajesh Singh","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/buddydev.com\/mediapress\/api-guides\/the-gallery-loop\/","url":"https:\/\/buddydev.com\/mediapress\/api-guides\/the-gallery-loop\/","name":"The Gallery Loop &#8226; MediaPress | BuddyDev","isPartOf":{"@id":"https:\/\/buddydev.com\/mediapress\/#website"},"datePublished":"2015-04-30T16:40:51+00:00","dateModified":"2015-04-30T16:44:27+00:00","author":{"@id":"https:\/\/buddydev.com\/mediapress\/#\/schema\/person\/4ebf5f3e519f8cbddc6583e182dbe4fb"},"breadcrumb":{"@id":"https:\/\/buddydev.com\/mediapress\/api-guides\/the-gallery-loop\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/buddydev.com\/mediapress\/api-guides\/the-gallery-loop\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/buddydev.com\/mediapress\/api-guides\/the-gallery-loop\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/buddydev.com\/mediapress\/"},{"@type":"ListItem","position":2,"name":"The Gallery Loop"}]},{"@type":"WebSite","@id":"https:\/\/buddydev.com\/mediapress\/#website","url":"https:\/\/buddydev.com\/mediapress\/","name":"MediaPress | BuddyDev","description":"The Best Media Gallery Plugin For BuddyPress","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/buddydev.com\/mediapress\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/buddydev.com\/mediapress\/#\/schema\/person\/4ebf5f3e519f8cbddc6583e182dbe4fb","name":"Brajesh Singh","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/buddydev.com\/mediapress\/#\/schema\/person\/image\/","url":"\/\/www.gravatar.com\/avatar\/2106622ee90d53d15ac1402806616aca?s=96&#038;r=g&#038;d=identicon","contentUrl":"\/\/www.gravatar.com\/avatar\/2106622ee90d53d15ac1402806616aca?s=96&#038;r=g&#038;d=identicon","caption":"Brajesh Singh"},"sameAs":["http:\/\/buddydev.com\/members\/sbrajesh\/","https:\/\/x.com\/sbrajesh"]}]}},"_links":{"self":[{"href":"https:\/\/buddydev.com\/mediapress\/wp-json\/wp\/v2\/posts\/77","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/buddydev.com\/mediapress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/buddydev.com\/mediapress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/buddydev.com\/mediapress\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/buddydev.com\/mediapress\/wp-json\/wp\/v2\/comments?post=77"}],"version-history":[{"count":4,"href":"https:\/\/buddydev.com\/mediapress\/wp-json\/wp\/v2\/posts\/77\/revisions"}],"predecessor-version":[{"id":82,"href":"https:\/\/buddydev.com\/mediapress\/wp-json\/wp\/v2\/posts\/77\/revisions\/82"}],"wp:attachment":[{"href":"https:\/\/buddydev.com\/mediapress\/wp-json\/wp\/v2\/media?parent=77"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/buddydev.com\/mediapress\/wp-json\/wp\/v2\/categories?post=77"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/buddydev.com\/mediapress\/wp-json\/wp\/v2\/tags?post=77"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}