{"id":686,"date":"2019-08-27T18:52:06","date_gmt":"2019-08-27T18:52:06","guid":{"rendered":"https:\/\/buddydev.com\/mediapress\/?p=686"},"modified":"2019-08-27T18:54:42","modified_gmt":"2019-08-27T18:54:42","slug":"renaming-wall-gallery-title-for-mediapress","status":"publish","type":"post","link":"https:\/\/buddydev.com\/mediapress\/code-snippets\/renaming-wall-gallery-title-for-mediapress\/","title":{"rendered":"Renaming Wall gallery title for MediaPress"},"content":{"rendered":"<p>If you do not like the way we name wall gallery of a user or group, you can rename it. You can either translate the plugin and specify a translation for the string &#8216;%s wall %s gallery&#8217;. That will be used when new wall galleries be created.<\/p>\n<p>You can\u00a0 also use code to modify it in a better flexible way.<\/p>\n<h3 id=\"example-1\">Example 1:- Changing &#8216;Wall gallery&#8217; to &#8216;Profile Gallery&#8217;<\/h3>\n<pre class=\"lang:default decode:true \">\/**\r\n * Filter wall gallery title\r\n *\r\n * @param string $title name of the wall gallery.\r\n * @param array  $args {\r\n *  Context details.\r\n * @type string $component component name(e.g groups|members|sitewide)\r\n * @type int    $component_id numeric component id( e.g group id or user id based on the component)\r\n * @type string $type media type(e.g photo, video,audio, doc etc)\r\n *\r\n * }\r\n *\r\n * @return string new title\r\n *\/\r\nfunction mpp_custom_wall_gallery_name( $title, $args ) {\r\n\t\/\/ Profile photo gallery etc.\r\n\t\/\/ Profile video gallery etc.\r\n\treturn sprintf( 'Profile %s gallery', strtolower( mpp_get_type_singular_name( $args['type'] ) ) );\r\n}\r\nadd_filter( 'mpp_wall_gallery_title', 'mpp_custom_wall_gallery_name', 10, 2 );\r\n<\/pre>\n<h3 id=\"example-2\">Example 2:- Include user&#8217;s name in the gallery<\/h3>\n<pre class=\"lang:default decode:true\">\/**\r\n * Filter wall gallery title to include user's display name in it.\r\n *\r\n * @param string $title name of the wall gallery.\r\n * @param array  $args {\r\n *  Context details.\r\n * @type string $component component name(e.g groups|members|sitewide)\r\n * @type int    $component_id numeric component id( e.g group id or user id based on the component)\r\n * @type string $type media type(e.g photo, video,audio, doc etc)\r\n *\r\n * }\r\n *\r\n * @return string new title\r\n *\/\r\nfunction mpp_custom_wall_gallery_name_with_user_displayname( $title, $args ) {\r\n\r\n\t\/\/ The names be like\r\n\t\/\/ Tom's photo gallery\r\n\t\/\/ Eric's video gallery and so on.\r\n\tif ( 'members' === $args['component'] ) {\r\n\t\t$title = sprintf( \"%s's wall %s gallery\", bp_core_get_user_displayname( $args['component_id'] )-&gt;name, strtolower( mpp_get_type_singular_name( $args['type'] ) ) );\r\n\t}\r\n\r\n\treturn $title;\r\n}\r\nadd_filter( 'mpp_wall_gallery_title', 'mpp_custom_wall_gallery_name_with_user_displayname', 10, 2 );\r\n\r\n<\/pre>\n<h3 id=\"example-3\">Example 3:- Include group&#8217;s name in the group wall gallery title.<\/h3>\n<pre class=\"lang:default decode:true\">\/**\r\n * Filter wall gallery title\r\n *\r\n * @param string $title name of the wall gallery.\r\n * @param array  $args {\r\n *  Context details.\r\n * @type string $component component name(e.g groups|members|sitewide)\r\n * @type int    $component_id numeric component id( e.g group id or user id based on the component)\r\n * @type string $type media type(e.g photo, video,audio, doc etc)\r\n *\r\n * }\r\n *\r\n * @return string new title\r\n *\/\r\nfunction mpp_custom_wall_gallery_name_with_group_name( $title, $args ) {\r\n\r\n\t\/\/ in this example, we are going to change the title for the groups wall gallery like this\r\n\t\/\/ &lt;group name&gt; wall gallery.\r\n\tif ( 'groups' === $args['component'] ) {\r\n\t\t$title = sprintf( '%s wall %s gallery', groups_get_group( $args['component_id'] )-&gt;name, strtolower( mpp_get_type_singular_name( $args['type'] ) ) );\r\n\t}\r\n\r\n\treturn $title;\r\n}\r\nadd_filter( 'mpp_wall_gallery_title', 'mpp_custom_wall_gallery_name_with_group_name', 10, 2 );\r\n\r\n<\/pre>\n<h3 id=\"example-4\">Example 4:- Name wall gallery to include user or group name:-<\/h3>\n<pre class=\"lang:default decode:true  \">\/**\r\n * Filter wall gallery title\r\n *\r\n * @param string $title name of the wall gallery.\r\n * @param array $args {\r\n *  Context details.\r\n *\r\n * @type string $component component name(e.g groups|members|sitewide)\r\n * @type int $component_id numeric component id( e.g group id or user id based on the component)\r\n * @type string $type media type(e.g photo, video,audio, doc etc)\r\n *\r\n * }\r\n *\r\n * @return string new title\r\n *\/\r\nfunction mpp_custom_wall_gallery_custom_name( $title, $args ) {\r\n\r\n\t\/\/ in this example, we are going to change the title for the groups wall gallery like this\r\n\t\/\/ &lt;group name&gt; wall &lt;type&gt; gallery.\r\n        \/\/&lt;display name&gt;'s wall &lt;type&gt; gallery\r\n\tif ( 'groups' === $args['component'] ) {\r\n\t\t$title = sprintf( '%s wall %s gallery', groups_get_group( $args['component_id'] )-&gt;name, strtolower( mpp_get_type_singular_name( $args['type'] ) ) );\r\n\t} elseif ( 'members' === $args['component'] ) {\r\n\t\t$title = sprintf( \"%s's wall %s gallery\", bp_core_get_user_displayname( $args['component_id'] )-&gt;name, strtolower( mpp_get_type_singular_name( $args['type'] ) ) );\r\n\r\n\t}\r\n\r\n\treturn $title;\r\n}\r\n\r\nadd_filter( 'mpp_wall_gallery_title', 'mpp_custom_wall_gallery_custom_name', 10, 2 );\r\n\r\n<\/pre>\n<p>Please feel free to adapt.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>If you do not like the way we name wall gallery of a user or group, you can rename it. You can either translate the plugin and specify a translation for the string &#8216;%s wall %s gallery&#8217;. That will be used when new wall galleries be created. You can\u00a0 also use code to modify it &#8230;<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8213],"tags":[],"class_list":["clearfix","post-686","post","type-post","status-publish","format-standard","hentry","category-code-snippets"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v25.9 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Renaming Wall gallery title for MediaPress &#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\/code-snippets\/renaming-wall-gallery-title-for-mediapress\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Renaming Wall gallery title for MediaPress &#8226; MediaPress | BuddyDev\" \/>\n<meta property=\"og:description\" content=\"If you do not like the way we name wall gallery of a user or group, you can rename it. You can either translate the plugin and specify a translation for the string &#8216;%s wall %s gallery&#8217;. That will be used when new wall galleries be created. You can\u00a0 also use code to modify it ...\" \/>\n<meta property=\"og:url\" content=\"https:\/\/buddydev.com\/mediapress\/code-snippets\/renaming-wall-gallery-title-for-mediapress\/\" \/>\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=\"2019-08-27T18:52:06+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2019-08-27T18:54:42+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\/code-snippets\/renaming-wall-gallery-title-for-mediapress\/\",\"url\":\"https:\/\/buddydev.com\/mediapress\/code-snippets\/renaming-wall-gallery-title-for-mediapress\/\",\"name\":\"Renaming Wall gallery title for MediaPress &#8226; MediaPress | BuddyDev\",\"isPartOf\":{\"@id\":\"https:\/\/buddydev.com\/mediapress\/#website\"},\"datePublished\":\"2019-08-27T18:52:06+00:00\",\"dateModified\":\"2019-08-27T18:54:42+00:00\",\"author\":{\"@id\":\"https:\/\/buddydev.com\/mediapress\/#\/schema\/person\/4ebf5f3e519f8cbddc6583e182dbe4fb\"},\"breadcrumb\":{\"@id\":\"https:\/\/buddydev.com\/mediapress\/code-snippets\/renaming-wall-gallery-title-for-mediapress\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/buddydev.com\/mediapress\/code-snippets\/renaming-wall-gallery-title-for-mediapress\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/buddydev.com\/mediapress\/code-snippets\/renaming-wall-gallery-title-for-mediapress\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/buddydev.com\/mediapress\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Renaming Wall gallery title for MediaPress\"}]},{\"@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":"Renaming Wall gallery title for MediaPress &#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\/code-snippets\/renaming-wall-gallery-title-for-mediapress\/","og_locale":"en_US","og_type":"article","og_title":"Renaming Wall gallery title for MediaPress &#8226; MediaPress | BuddyDev","og_description":"If you do not like the way we name wall gallery of a user or group, you can rename it. You can either translate the plugin and specify a translation for the string &#8216;%s wall %s gallery&#8217;. That will be used when new wall galleries be created. You can\u00a0 also use code to modify it ...","og_url":"https:\/\/buddydev.com\/mediapress\/code-snippets\/renaming-wall-gallery-title-for-mediapress\/","og_site_name":"MediaPress | BuddyDev","article_publisher":"https:\/\/www.facebook.com\/bpdev","article_published_time":"2019-08-27T18:52:06+00:00","article_modified_time":"2019-08-27T18:54:42+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\/code-snippets\/renaming-wall-gallery-title-for-mediapress\/","url":"https:\/\/buddydev.com\/mediapress\/code-snippets\/renaming-wall-gallery-title-for-mediapress\/","name":"Renaming Wall gallery title for MediaPress &#8226; MediaPress | BuddyDev","isPartOf":{"@id":"https:\/\/buddydev.com\/mediapress\/#website"},"datePublished":"2019-08-27T18:52:06+00:00","dateModified":"2019-08-27T18:54:42+00:00","author":{"@id":"https:\/\/buddydev.com\/mediapress\/#\/schema\/person\/4ebf5f3e519f8cbddc6583e182dbe4fb"},"breadcrumb":{"@id":"https:\/\/buddydev.com\/mediapress\/code-snippets\/renaming-wall-gallery-title-for-mediapress\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/buddydev.com\/mediapress\/code-snippets\/renaming-wall-gallery-title-for-mediapress\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/buddydev.com\/mediapress\/code-snippets\/renaming-wall-gallery-title-for-mediapress\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/buddydev.com\/mediapress\/"},{"@type":"ListItem","position":2,"name":"Renaming Wall gallery title for MediaPress"}]},{"@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\/686","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=686"}],"version-history":[{"count":5,"href":"https:\/\/buddydev.com\/mediapress\/wp-json\/wp\/v2\/posts\/686\/revisions"}],"predecessor-version":[{"id":691,"href":"https:\/\/buddydev.com\/mediapress\/wp-json\/wp\/v2\/posts\/686\/revisions\/691"}],"wp:attachment":[{"href":"https:\/\/buddydev.com\/mediapress\/wp-json\/wp\/v2\/media?parent=686"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/buddydev.com\/mediapress\/wp-json\/wp\/v2\/categories?post=686"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/buddydev.com\/mediapress\/wp-json\/wp\/v2\/tags?post=686"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}