{"id":10196393,"date":"2018-04-18T23:37:50","date_gmt":"2018-04-18T23:37:50","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/problem-while-creating-a-functionality-plugin\/"},"modified":"2018-04-18T23:37:50","modified_gmt":"2018-04-18T23:37:50","slug":"problem-while-creating-a-functionality-plugin","status":"publish","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/problem-while-creating-a-functionality-plugin\/","title":{"rendered":"problem while creating a functionality plugin"},"content":{"rendered":"<p>Hi,<br \/>\nThanks in advance for any help you will provide. I am not an English speaker so i wil try to explain you the best i can what issues i am facing actually.<\/p>\n<p>On my website i&#8217;d like to add in some pages (i want to decide which) a map that all the members of my website could &#8220;customize&#8221;. By customize i mean that i want them to add placemarkers with a description and even personal pictures on the map. And i want all these placemarkers to be shown so that when you look at the global map you can see all the places that my members recommend to other members.<\/p>\n<p>If i understood well what is in the plugin&#8217;s description, it seems that for reaching my goals i need to create a functionality plugin. So i have done like this. Gone to my PHP folder &#8211;&gt; wp content &#8211;&gt; plugins &#8211;&gt; create a new folder called &#8220;carte-interactive-google&#8221; &#8211;&gt; create a php file called &#8220;carte-interactive-google&#8221;. And this is what i enter in this file:<\/p>\n<p>&lt;?php<br \/>\n\/*<br \/>\nPlugin Name: Carte interactive Google<br \/>\nPlugin URI: http:\/\/alternative-diving.club<br \/>\nDescription: Carte interactive Google permettant \u00e0 chaque membre de pouvoir notifier lui-m\u00eame des lieux qu&#8217;il appr\u00e9cie.<br \/>\nVersion: 1.0<br \/>\nAuthor: DLS<br \/>\n*\/<\/p>\n<p>function bgmpShortcodeCalled()<br \/>\n{<br \/>\n    global $post;<\/p>\n<p>    $shortcodePageSlugs = array(<br \/>\n        &#8216;les-sites&#8217;,<br \/>\n        &#8216;second-page-slug&#8217;<br \/>\n    );<\/p>\n<p>    if( $post )<br \/>\n        if( in_array( $post-&gt;post_name, $shortcodePageSlugs ) )<br \/>\n            add_filter( &#8216;bgmp_map-shortcode-called&#8217;, &#8216;__return_true&#8217; );<br \/>\n}<br \/>\nadd_action( &#8216;wp&#8217;, &#8216;bgmpShortcodeCalled&#8217; );<br \/>\nThen i activated the plugin in my plugin library.<\/p>\n<p>Now when i look at the page in which i want to show up this interactive map for my members it seems that it doesn&#8217;t work. The instructions provided are <em>&#8220;Copy and paste that into your theme\u2019s functions.php file or a functionality plugin, update the function names and filter arguments, and then add the slugs of any pages\/posts containing the map to $shortcodePageSlugs.&#8221;<\/em> And i think that i haven&#8217;t understood this page. So can you help me ? Cause i don&#8217;t understand what needs to be changed in that code and by which words.<\/p>\n","protected":false},"template":"","class_list":["post-10196393","topic","type-topic","status-publish","hentry"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/10196393","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/10196393\/revisions"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=10196393"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}